-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
664 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
import Context from '../_utils/context'; | ||
|
||
describe( 'Context', () => { | ||
describe( 'constructor()', () => { | ||
it( 'saves the config', () => { | ||
const config = { foo: 'bar' }; | ||
const context = new Context( config ); | ||
|
||
expect( context.config ).to.equal( config ); | ||
} ); | ||
} ); | ||
|
||
describe( 'destroy()', () => { | ||
it( 'should return a promise that resolves properly', () => { | ||
return Context.create() | ||
.then( context => { | ||
const promise = context.destroy(); | ||
|
||
expect( promise ).to.be.an.instanceof( Promise ); | ||
|
||
return promise; | ||
} ); | ||
} ); | ||
} ); | ||
|
||
describe( 'create()', () => { | ||
it( 'should return a promise that resolves properly', () => { | ||
const promise = Context.create(); | ||
|
||
expect( promise ).to.be.an.instanceof( Promise ); | ||
|
||
return promise; | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
/** | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* global window */ | ||
|
||
/** | ||
* Turns off the default error catching | ||
* so Mocha won't complain about errors caused by the called function. | ||
*/ | ||
export default async function turnOffDefaultErrorCatching( fn ) { | ||
const originalOnError = window.onerror; | ||
window.onerror = null; | ||
import turnOffDefaultErrorCatching from '../_utils/turnoffdefaulterrorcatching'; | ||
|
||
describe( 'turnOffDefaultErrorCatching()', () => { | ||
it( 'should catch the error', () => { | ||
const onErrorStub = sinon.stub( window, 'onerror' ); | ||
|
||
turnOffDefaultErrorCatching( () => { | ||
window.onerror( 'Foo', null, 0 ); | ||
} ); | ||
|
||
await fn(); | ||
onErrorStub.restore(); | ||
|
||
window.onerror = originalOnError; | ||
} | ||
expect( onErrorStub.called ).to.equal( false ); | ||
} ); | ||
} ); |
Oops, something went wrong.