global.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* global window, document */
  6. import global from '../../src/dom/global';
  7. import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
  8. describe( 'global', () => {
  9. testUtils.createSinonSandbox();
  10. describe( 'global', () => {
  11. describe( 'window', () => {
  12. it( 'equals native DOM window', () => {
  13. expect( global.window ).to.equal( window );
  14. } );
  15. it( 'stubs', () => {
  16. testUtils.sinon.stub( global, 'window' ).value( {
  17. scrollX: 100
  18. } );
  19. expect( global.window ).to.deep.equal( {
  20. scrollX: 100
  21. } );
  22. } );
  23. } );
  24. describe( 'document', () => {
  25. it( 'equals native DOM document', () => {
  26. expect( global.document ).to.equal( document );
  27. } );
  28. it( 'stubs', () => {
  29. testUtils.sinon.stub( global, 'document' ).value( {
  30. foo: 'abc'
  31. } );
  32. expect( global.document ).to.deep.equal( {
  33. foo: 'abc'
  34. } );
  35. } );
  36. } );
  37. } );
  38. } );