| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- @use 'sass:map';
- @use 'sass:meta';
- @use 'sass:list';
- @use 'true' as test;
- @use '../shape';
- @include test.describe('shape') {
- @include test.describe('resolver($shape)') {
- @include test.it('should return null for all corners if given null') {
- // Test Case.
- $result: shape.resolver(
- $shape: null,
- );
- // Assertion.
- $is-map: meta.type-of($result) == 'map';
- @include test.assert-true(
- $is-map,
- $description: 'Should always return a Map'
- );
- @include test.assert-equal(
- map.get($result, start-start),
- null,
- $description: 'start-start should be null'
- );
- @include test.assert-equal(
- map.get($result, start-end),
- null,
- $description: 'start-end should be null'
- );
- @include test.assert-equal(
- map.get($result, end-end),
- null,
- $description: 'end-end should be null'
- );
- @include test.assert-equal(
- map.get($result, end-start),
- null,
- $description: 'end-start should be null'
- );
- }
- @include test.it('should expand radius number to all corners') {
- // Test Case.
- $result: shape.resolver(
- $shape: 8px,
- );
- // Assertion.
- $is-map: meta.type-of($result) == 'map';
- @include test.assert-true(
- $is-map,
- $description: 'Should always return a Map'
- );
- @include test.assert-equal(
- map.get($result, start-start),
- 8px,
- $description: 'start-start should be same as input'
- );
- @include test.assert-equal(
- map.get($result, start-end),
- 8px,
- $description: 'start-end should be same as input'
- );
- @include test.assert-equal(
- map.get($result, end-end),
- 8px,
- $description: 'end-end should be same as input'
- );
- @include test.assert-equal(
- map.get($result, end-start),
- 8px,
- $description: 'end-start should be same as input'
- );
- }
- @include test.it('should expand radius list with 1 to all corners') {
- // Test Case.
- $result: shape.resolver(
- $shape: (
- 16px,
- ),
- );
- // Assertion.
- $is-map: meta.type-of($result) == 'map';
- @include test.assert-true(
- $is-map,
- $description: 'Should always return a Map'
- );
- @include test.assert-equal(
- map.get($result, start-start),
- 16px,
- $description: 'start-start should be the first corner'
- );
- @include test.assert-equal(
- map.get($result, start-end),
- 16px,
- $description: 'start-end should be the first corner'
- );
- @include test.assert-equal(
- map.get($result, end-end),
- 16px,
- $description: 'end-end should be the first corner'
- );
- @include test.assert-equal(
- map.get($result, end-start),
- 16px,
- $description: 'end-start should be the first corner'
- );
- }
- @include test.it('should expand radius list with 2 to correct corners') {
- // Test Case.
- $result: shape.resolver(
- $shape: (
- 8px,
- 16px,
- ),
- );
- // Assertion.
- $is-map: meta.type-of($result) == 'map';
- @include test.assert-true(
- $is-map,
- $description: 'Should always return a Map'
- );
- @include test.assert-equal(
- map.get($result, start-start),
- 8px,
- $description: 'start-start should be the first corner'
- );
- @include test.assert-equal(
- map.get($result, start-end),
- 16px,
- $description: 'start-end should be the second corner'
- );
- @include test.assert-equal(
- map.get($result, end-end),
- 8px,
- $description: 'end-end should be the first corner'
- );
- @include test.assert-equal(
- map.get($result, end-start),
- 16px,
- $description: 'end-start should be the second corner'
- );
- }
- @include test.it('should expand radius list with 3 to correct corners') {
- // Test Case.
- $result: shape.resolver(
- $shape: (
- 8px,
- 16px,
- 24px,
- ),
- );
- // Assertion.
- $is-map: meta.type-of($result) == 'map';
- @include test.assert-true(
- $is-map,
- $description: 'Should always return a Map'
- );
- @include test.assert-equal(
- map.get($result, start-start),
- 8px,
- $description: 'start-start should be the first corner'
- );
- @include test.assert-equal(
- map.get($result, start-end),
- 16px,
- $description: 'start-end should be the second corner'
- );
- @include test.assert-equal(
- map.get($result, end-end),
- 24px,
- $description: 'end-end should be the third corner'
- );
- @include test.assert-equal(
- map.get($result, end-start),
- 16px,
- $description: 'end-start should be the second corner'
- );
- }
- @include test.it('should expand radius list with 4 to correct corners') {
- // Test Case.
- $result: shape.resolver(
- $shape: (
- 8px,
- 16px,
- 24px,
- 0,
- ),
- );
- // Assertion.
- $is-map: meta.type-of($result) == 'map';
- @include test.assert-true(
- $is-map,
- $description: 'Should always return a Map'
- );
- @include test.assert-equal(
- map.get($result, start-start),
- 8px,
- $description: 'start-start should be the first corner'
- );
- @include test.assert-equal(
- map.get($result, start-end),
- 16px,
- $description: 'start-end should be the second corner'
- );
- @include test.assert-equal(
- map.get($result, end-end),
- 24px,
- $description: 'end-end should be the third corner'
- );
- @include test.assert-equal(
- map.get($result, end-start),
- 0,
- $description: 'end-start should be the fourth corner'
- );
- }
- }
- }
|