|
10 | 10 | * governing permissions and limitations under the License.
|
11 | 11 | */
|
12 | 12 |
|
13 |
| -import {dimensionValue} from '../'; |
| 13 | +import {convertStyleProps, dimensionValue, viewStyleProps} from '../'; |
14 | 14 |
|
15 | 15 |
|
16 | 16 | describe('styleProps', function () {
|
@@ -67,4 +67,24 @@ describe('styleProps', function () {
|
67 | 67 | });
|
68 | 68 | });
|
69 | 69 | });
|
| 70 | + |
| 71 | + describe('borderSizeValue', function () { |
| 72 | + it('should default to 0 if base is undefined', function () { |
| 73 | + let style = convertStyleProps({borderEndWidth: {S: 'thin'}}, viewStyleProps, 'ltr', ['base']); |
| 74 | + expect(style.borderRightWidth).toBe('0'); |
| 75 | + style = convertStyleProps({borderEndWidth: {S: 'thin'}}, viewStyleProps, 'ltr', ['S', 'base']); |
| 76 | + expect(style.borderRightWidth).toBe('var(--spectrum-alias-border-size-thin)'); |
| 77 | + style = convertStyleProps({borderEndWidth: {S: 'thin'}}, viewStyleProps, 'ltr', ['M', 'S', 'base']); |
| 78 | + expect(style.borderRightWidth).toBe('var(--spectrum-alias-border-size-thin)'); |
| 79 | + }); |
| 80 | + |
| 81 | + it('should accept "none" to unset the border size', function () { |
| 82 | + let style = convertStyleProps({borderEndWidth: {S: 'thick', M: 'none', L: 'thin'}}, viewStyleProps, 'ltr', ['S', 'base']); |
| 83 | + expect(style.borderRightWidth).toBe('var(--spectrum-alias-border-size-thick)'); |
| 84 | + style = convertStyleProps({borderEndWidth: {S: 'thick', M: 'none', L: 'thin'}}, viewStyleProps, 'ltr', ['M', 'S', 'base']); |
| 85 | + expect(style.borderRightWidth).toBe('0'); |
| 86 | + style = convertStyleProps({borderEndWidth: {S: 'thick', M: 'none', L: 'thin'}}, viewStyleProps, 'ltr', ['L', 'M', 'S', 'base']); |
| 87 | + expect(style.borderRightWidth).toBe('var(--spectrum-alias-border-size-thin)'); |
| 88 | + }); |
| 89 | + }); |
70 | 90 | });
|
0 commit comments