getborderwidths.js 829 B

1234567891011121314151617181920212223242526272829303132333435
  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. import getBorderWidths from '../../src/dom/getborderwidths';
  6. import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
  7. describe( 'getBorderWidths()', () => {
  8. testUtils.createSinonSandbox();
  9. it( 'returns CSS border widths', () => {
  10. const elementMock = {
  11. ownerDocument: {
  12. defaultView: {
  13. getComputedStyle: () => {
  14. return {
  15. borderTopWidth: '10px',
  16. borderRightWidth: '20px',
  17. borderBottomWidth: '30px',
  18. borderLeftWidth: '40px'
  19. };
  20. }
  21. }
  22. }
  23. };
  24. expect( getBorderWidths( elementMock ) ).to.deep.equal( {
  25. top: 10,
  26. right: 20,
  27. bottom: 30,
  28. left: 40
  29. } );
  30. } );
  31. } );