Quellcode durchsuchen

test helped to fix 1 bug (clear example menu when back home)

Benoît Hubert vor 8 Jahren
Ursprung
Commit
f0cb202186
2 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen
  1. 6 1
      js/test/ws.test.js
  2. 1 0
      js/ws-menu.js

+ 6 - 1
js/test/ws.test.js

@@ -52,7 +52,7 @@ function timeoutAsync(cb, delay) {
       .then(() => timeoutAsync(() => {
         assert.equal( $mainMenu.width(), 0, "2.AFTER 2ND CLICK width should be 0" );
         done();
-      }, 160));
+      }, 180));
     });
 
 
@@ -83,8 +83,13 @@ function timeoutAsync(cb, delay) {
 
 
     QUnit.test( "test nav back to home", function( assert ) {
+      var done = assert.async();
       $homeLink.trigger('click');
       assert.ok( window.location.pathname, '/', "location should be / when clicking app title" );
+      timeoutAsync(() => {
+        assert.equal( ($menuExample.find('a')).length, 0, "menu example should contain 0 entry" );
+        done();
+      }, 50);
     });
 
 

+ 1 - 0
js/ws-menu.js

@@ -60,6 +60,7 @@
         if(navState.repo === '') {
           console.log('nav: back to root');
           _ws.events.emit('navToRoot');
+          _ws.ui.menuExample.render({ examples: [] });
         }
         else {
           console.log('nav: repo changed');