|
1 | 1 | import * as React from 'react'; |
2 | 2 | import { expect } from 'chai'; |
3 | 3 | import { createRenderer } from '@mui-internal/test-utils'; |
| 4 | +import { styled } from '@mui/material/styles'; |
4 | 5 | import Divider, { dividerClasses as classes } from '@mui/material/Divider'; |
5 | 6 | import describeConformance from '../../test/describeConformance'; |
6 | 7 |
|
@@ -83,6 +84,40 @@ describe('<Divider />', () => { |
83 | 84 | expect(container.querySelectorAll(`.${classes.textAlignLeft}`).length).to.equal(0); |
84 | 85 | }); |
85 | 86 | }); |
| 87 | + |
| 88 | + describe('custom border style', function test() { |
| 89 | + before(function beforeHook() { |
| 90 | + if (/jsdom/.test(window.navigator.userAgent)) { |
| 91 | + this.skip(); |
| 92 | + } |
| 93 | + }); |
| 94 | + |
| 95 | + const StyledDivider = styled(Divider)(() => ({ |
| 96 | + borderStyle: 'dashed', |
| 97 | + })); |
| 98 | + |
| 99 | + it('should set the dashed border-left-style in before and after pseudo-elements when orientation is vertical', () => { |
| 100 | + const { container } = render(<StyledDivider orientation="vertical">content</StyledDivider>); |
| 101 | + expect( |
| 102 | + getComputedStyle(container.firstChild, '::before').getPropertyValue('border-left-style'), |
| 103 | + ).to.equal('dashed'); |
| 104 | + expect( |
| 105 | + getComputedStyle(container.firstChild, '::after').getPropertyValue('border-left-style'), |
| 106 | + ).to.equal('dashed'); |
| 107 | + }); |
| 108 | + |
| 109 | + it('should set the dashed border-top-style in before and after pseudo-elements when orientation is horizontal', () => { |
| 110 | + const { container } = render( |
| 111 | + <StyledDivider orientation="horizontal">content</StyledDivider>, |
| 112 | + ); |
| 113 | + expect( |
| 114 | + getComputedStyle(container.firstChild, '::before').getPropertyValue('border-top-style'), |
| 115 | + ).to.equal('dashed'); |
| 116 | + expect( |
| 117 | + getComputedStyle(container.firstChild, '::after').getPropertyValue('border-top-style'), |
| 118 | + ).to.equal('dashed'); |
| 119 | + }); |
| 120 | + }); |
86 | 121 | }); |
87 | 122 |
|
88 | 123 | describe('prop: variant', () => { |
|
0 commit comments