-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose typeW3CDelegate util function (#1087)
* feat: expose typeW3CDelegate util function * fix: small bug with w3c type delegate util (#1088)
- Loading branch information
1 parent
7a1e446
commit 0c1a36f
Showing
8 changed files
with
178 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'style-dictionary': patch | ||
--- | ||
|
||
Fix small issue in type w3c delegate utility type tracking. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'style-dictionary': patch | ||
--- | ||
|
||
Expose typeW3CDelegate utility. Don't take "value" into account anymore to determine that it's a design token, use $value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with | ||
* the License. A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
import { expect } from 'chai'; | ||
import { typeW3CDelegate } from '../../lib/utils/preprocess.js'; | ||
|
||
describe('utils', () => { | ||
describe('typeW3CDelegate', () => { | ||
it('should correctly let tokens inherit the $type property while respecting local overrides', () => { | ||
const tokens = { | ||
dimension: { | ||
$type: 'dimension', | ||
scale: { | ||
$value: '2', | ||
$type: 'math', | ||
}, | ||
xs: { | ||
$value: '4', | ||
}, | ||
nested: { | ||
deep: { | ||
deeper: { | ||
$value: '12', | ||
}, | ||
}, | ||
deep2: { | ||
$type: 'math', | ||
deeper: { | ||
$type: 'other', | ||
evenDeeper: { | ||
$value: '12', | ||
$type: 'math', | ||
}, | ||
evenDeeper2: { | ||
$value: '12', | ||
}, | ||
}, | ||
}, | ||
}, | ||
sm: { | ||
$value: '8', | ||
}, | ||
}, | ||
}; | ||
|
||
expect(typeW3CDelegate(tokens)).to.eql({ | ||
dimension: { | ||
$type: 'dimension', | ||
scale: { | ||
$value: '2', | ||
$type: 'math', | ||
}, | ||
xs: { | ||
$value: '4', | ||
$type: 'dimension', | ||
}, | ||
nested: { | ||
deep: { | ||
deeper: { | ||
$value: '12', | ||
$type: 'dimension', | ||
}, | ||
}, | ||
deep2: { | ||
$type: 'math', | ||
deeper: { | ||
$type: 'other', | ||
evenDeeper: { | ||
$value: '12', | ||
$type: 'math', | ||
}, | ||
evenDeeper2: { | ||
$value: '12', | ||
$type: 'other', | ||
}, | ||
}, | ||
}, | ||
}, | ||
sm: { | ||
$value: '8', | ||
$type: 'dimension', | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters