Bladeren bron

Update inspector tests.

Afshin Darian 8 jaren geleden
bovenliggende
commit
69aa831c20
1 gewijzigde bestanden met toevoegingen van 31 en 0 verwijderingen
  1. 31 0
      test/src/inspector/inspector.spec.ts

+ 31 - 0
test/src/inspector/inspector.spec.ts

@@ -7,11 +7,25 @@ import {
   ISignal, defineSignal
 } from 'phosphor/lib/core/signaling';
 
+import {
+  Widget
+} from 'phosphor/lib/ui/widget';
+
 import {
   Inspector
 } from '../../../lib/inspector';
 
 
+class TestInspector extends Inspector {
+  methods: string[] = [];
+
+  protected onInspectorUpdate(sender: any, args: Inspector.IInspectorUpdate): void {
+    super.onInspectorUpdate(sender, args);
+    this.methods.push('onInspectorUpdate');
+  }
+}
+
+
 class TestInspectable implements Inspector.IInspectable {
   disposed: ISignal<any, void>;
 
@@ -97,6 +111,23 @@ describe('inspector/index', () => {
 
     });
 
+
+    describe('#onInspectorUpdate()', () => {
+
+      it('should fire when a source updates', () => {
+        let options: Inspector.IOptions = {};
+        let widget = new TestInspector(options);
+        widget.source = new TestInspectable();
+        expect(widget.methods).to.not.contain('onInspectorUpdate');
+        widget.source.inspected.emit({
+          content: new Widget(),
+          type: 'hints'
+        });
+        expect(widget.methods).to.contain('onInspectorUpdate');
+      });
+
+    });
+
   });
 
 });