Procházet zdrojové kódy

Update json editor test

Steven Silvester před 7 roky
rodič
revize
d0eb24a6c5
2 změnil soubory, kde provedl 25 přidání a 1 odebrání
  1. 24 0
      test/src/codeeditor/jsoneditor.spec.ts
  2. 1 1
      test/src/index.ts

+ 24 - 0
test/src/apputils/jsoneditor.spec.ts → test/src/codeeditor/jsoneditor.spec.ts

@@ -44,6 +44,16 @@ class LogEditor extends JSONEditor {
     this.methods.push('onAfterAttach');
   }
 
+  protected onAfterShow(msg: Message): void {
+    super.onAfterShow(msg);
+    this.methods.push('onAfterShow');
+  }
+
+  protected onUpdateRequest(msg: Message): void {
+    super.onUpdateRequest(msg);
+    this.methods.push('onUpdateRequest');
+  }
+
   protected onBeforeDetach(msg: Message): void {
     super.onBeforeDetach(msg);
     this.methods.push('onBeforeDetach');
@@ -398,6 +408,20 @@ describe('apputils', () => {
 
     });
 
+    describe('#onAfterShow()', () => {
+
+      it('should update the editor', done => {
+        editor.hide();
+        Widget.attach(editor, document.body);
+        editor.show();
+        requestAnimationFrame(() => {
+          expect(editor.methods).to.contain('onUpdateRequest');
+          done();
+        });
+      });
+
+    });
+
     describe('#onBeforeDetach()', () => {
 
       it('should remove event listeners', () => {

+ 1 - 1
test/src/index.ts

@@ -11,7 +11,6 @@ import './apputils/commandlinker.spec';
 import './apputils/dialog.spec';
 import './apputils/iframe.spec';
 import './apputils/instancetracker.spec';
-import './apputils/jsoneditor.spec';
 import './apputils/sanitizer.spec';
 import './apputils/statedb.spec';
 import './apputils/styling.spec';
@@ -23,6 +22,7 @@ import './cells/model.spec';
 import './cells/widget.spec';
 
 import './codeeditor/editor.spec';
+import './codeeditor/jsoneditor.spec';
 import './codeeditor/widget.spec';
 
 import './codemirror/editor.spec';