|
|
@@ -101,9 +101,6 @@ describe( 'FakeSelectionObserver', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'should fire `selectionChangeDone` event after selection stop changing', ( done ) => {
|
|
|
- // Note that it's difficult to test lodash#debounce with sinon fake timers.
|
|
|
- // See: https://github.com/lodash/lodash/issues/304
|
|
|
-
|
|
|
const spy = sinon.spy();
|
|
|
|
|
|
viewDocument.on( 'selectionChangeDone', spy );
|
|
|
@@ -112,6 +109,8 @@ describe( 'FakeSelectionObserver', () => {
|
|
|
changeFakeSelectionPressing( keyCodes.arrowdown );
|
|
|
|
|
|
// Wait 100ms.
|
|
|
+ // Note that it's difficult/not possible to test lodash#debounce with sinon fake timers.
|
|
|
+ // See: https://github.com/lodash/lodash/issues/304
|
|
|
setTimeout( () => {
|
|
|
// Check if spy was called.
|
|
|
expect( spy.notCalled ).to.true;
|
|
|
@@ -129,9 +128,6 @@ describe( 'FakeSelectionObserver', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'should not fire `selectionChangeDone` event when observer will be destroyed', ( done ) => {
|
|
|
- // Note that it's difficult to test lodash#debounce with sinon fake timers.
|
|
|
- // See: https://github.com/lodash/lodash/issues/304
|
|
|
-
|
|
|
const spy = sinon.spy();
|
|
|
|
|
|
viewDocument.on( 'selectionChangeDone', spy );
|
|
|
@@ -140,6 +136,8 @@ describe( 'FakeSelectionObserver', () => {
|
|
|
changeFakeSelectionPressing( keyCodes.arrowdown );
|
|
|
|
|
|
// Wait 100ms.
|
|
|
+ // Note that it's difficult/not possible to test lodash#debounce with sinon fake timers.
|
|
|
+ // See: https://github.com/lodash/lodash/issues/304
|
|
|
setTimeout( () => {
|
|
|
// And destroy observer.
|
|
|
observer.destroy();
|