|
|
@@ -103,23 +103,27 @@ function timeoutAsync(cb, delay) {
|
|
|
|
|
|
QUnit.test( "test adding a file", function( assert ) {
|
|
|
var done = assert.async();
|
|
|
- $linkToRepo1.trigger('click');
|
|
|
- var $linkToExmp1 = $menuExample.find('a:first');
|
|
|
- $linkToExmp1.trigger( 'click' );
|
|
|
var $addFile = $('#add-file');
|
|
|
var $addFileAddBtn = $addFile.find('.add-btn');
|
|
|
var $addFileForm = $addFile.find('form');
|
|
|
- assert.equal( $addFile.length, 1, "there should be one #add-file element" );
|
|
|
- assert.equal( $addFileForm.length, 1, "#add-file should contain one form element" );
|
|
|
- assert.ok( ! $addFileForm.is(':visible'), "the form element shouldn't be visible before clicking the + btn" );
|
|
|
- assert.ok( $addFileForm.width() === 0, "the form element shouldn't be visible before clicking the + btn" );
|
|
|
- // $addFileAddBtn.trigger( 'click' );
|
|
|
+ $linkToRepo1.trigger('click');
|
|
|
timeoutAsync(() => {
|
|
|
+ var $linkToExmp1 = $menuExample.find('a:first');
|
|
|
+ $linkToExmp1.trigger( 'click' );
|
|
|
+ }, 50)
|
|
|
+ .then(() => {
|
|
|
+ assert.equal( $addFile.length, 1, "there should be one #add-file element" );
|
|
|
+ assert.equal( $addFileForm.length, 1, "#add-file should contain one form element" );
|
|
|
+ // assert.ok( ! $addFileForm.is(':visible'), "the form element shouldn't be visible before clicking the + btn" );
|
|
|
+ assert.ok( $addFileForm.width() === 0, "the form element shouldn't be visible before clicking the + btn" );
|
|
|
+ $addFileAddBtn.trigger( 'click' );
|
|
|
+ })
|
|
|
+ .then(() => timeoutAsync(() => {
|
|
|
console.log( $addFileForm );
|
|
|
- assert.ok( $addFileForm.is(':visible'), "clicking on the + btn should have made the form appear" );
|
|
|
+ // assert.ok( $addFileForm.is(':visible'), "clicking on the + btn should have made the form appear" );
|
|
|
assert.ok( $addFileForm.width() > 0, "clicking on the + btn should have made the form appear" );
|
|
|
done();
|
|
|
- }, 100);
|
|
|
+ }, 100));
|
|
|
});
|
|
|
|
|
|
|