getborderwidths.js 769 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import global from '../../src/dom/global';
  6. import getBorderWidths from '../../src/dom/getborderwidths';
  7. import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
  8. testUtils.createSinonSandbox();
  9. describe( 'getBorderWidths()', () => {
  10. it( 'returns CSS border widths', () => {
  11. testUtils.sinon.stub( global.window, 'getComputedStyle' ).returns( {
  12. borderTopWidth: '10px',
  13. borderRightWidth: '20px',
  14. borderBottomWidth: '30px',
  15. borderLeftWidth: '40px'
  16. } );
  17. const elementMock = {};
  18. expect( getBorderWidths( elementMock ) ).to.deep.equal( {
  19. top: 10,
  20. right: 20,
  21. bottom: 30,
  22. left: 40
  23. } );
  24. } );
  25. } );