diff --git a/packages/ckeditor5-core/tests/editor/utils/editorusagedata.js b/packages/ckeditor5-core/tests/editor/utils/editorusagedata.js index 590b7a79b4d..18e3a675ff9 100644 --- a/packages/ckeditor5-core/tests/editor/utils/editorusagedata.js +++ b/packages/ckeditor5-core/tests/editor/utils/editorusagedata.js @@ -192,7 +192,7 @@ describe( 'getEditorUsageData()', () => { for ( const [ flag, osName ] of os ) { it( `should detect ${ osName } OS`, async () => { - sinon.stub( env, flag ).value( true ); + mockFlag( flag ); editor = await ClassicTestEditor.create( domElement, {} ); @@ -201,6 +201,12 @@ describe( 'getEditorUsageData()', () => { } ); } ); } + + function mockFlag( mockFlag ) { + for ( const [ flag ] of os ) { + sinon.stub( env, flag ).value( flag === mockFlag ); + } + } } ); describe( 'browser', () => { @@ -212,11 +218,7 @@ describe( 'getEditorUsageData()', () => { for ( const [ flag, browser ] of browsers ) { it( `should detect ${ browser } browser`, async () => { - sinon.stub( env, flag ).value( true ); - - if ( flag !== 'isBlink' ) { - sinon.stub( env, 'isBlink' ).value( false ); - } + mockFlag( flag ); editor = await ClassicTestEditor.create( domElement, {} ); @@ -225,6 +227,12 @@ describe( 'getEditorUsageData()', () => { } ); } ); } + + function mockFlag( mockFlag ) { + for ( const [ flag ] of browsers ) { + sinon.stub( env, flag ).value( flag === mockFlag ); + } + } } ); } );