-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2837 20 unable to create variable collections from sets #2844
Merged
six7
merged 33 commits into
release-139
from
2837-20-unable-to-create-variable-collections-from-sets
Jun 12, 2024
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
757e3a4
feat: add token format option to get exact resolved value
robinhoodie0823 64f7b9d
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 f2d07fa
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 9dc89e0
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 0cffbfd
revert the DTCG format
robinhoodie0823 912f318
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 6193450
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 6088f3e
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 493c938
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 3ccab01
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 1a05a7e
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 9e63e5c
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 92e52b8
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 7a40c4a
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 b425dbb
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 b04d373
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 dce0e98
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 b9c6fef
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 def9936
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 4fadfb8
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 0e1b690
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 2057bbb
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 50e0794
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 473befc
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 f414eaa
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 31361df
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 1391624
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 586c6b1
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 44ea5d1
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 9aba90f
Merge branch 'release-139' of https://github.com/tokens-studio/figma-…
robinhoodie0823 755fbd7
feat: add console logs to figure out issue
robinhoodie0823 adfbd44
feat: add logic to create collection based on selected sets
robinhoodie0823 f743f4a
feat: update to create all tokens as variables
robinhoodie0823 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
packages/tokens-studio-for-figma/src/plugin/createLocalVariablesWithoutModesInPlugin.test.ts
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,64 @@ | ||
import { mockCreateVariableCollection, mockGetLocalVariableCollections } from '../../tests/__mocks__/figmaMock'; | ||
import { TokenSetStatus } from '@/constants/TokenSetStatus'; | ||
import { TokenTypes } from '@/constants/TokenTypes'; | ||
import createLocalVariablesWithoutModesInPlugin from './createLocalVariablesWithoutModesInPlugin'; | ||
import { SingleToken } from '@/types/tokens'; | ||
import { SettingsState } from '@/app/store/models/settings'; | ||
|
||
describe('createLocalVariablesWithoutModesInPlugin', () => { | ||
const mockRenameMode = jest.fn(); | ||
|
||
const tokens = { | ||
global: [ | ||
{ | ||
name: 'button.primary.borderRadius', | ||
value: '8', | ||
type: TokenTypes.BORDER_RADIUS, | ||
} as SingleToken, | ||
{ | ||
name: 'button.primary.width', | ||
value: '16', | ||
type: TokenTypes.SIZING, | ||
} as SingleToken, | ||
], | ||
}; | ||
const settings = { | ||
baseFontSize: '16', | ||
} as SettingsState; | ||
|
||
it('when there is no collection which correspond to the theme, then we create a new collection', async () => { | ||
const mockLocalVariableCollections = [ | ||
{ | ||
id: 'VariableCollectionId:334:16746', | ||
modes: [ | ||
{ | ||
name: 'light', | ||
modeId: '123', | ||
}, | ||
], | ||
name: 'core', | ||
}, | ||
]; | ||
const mockNewCollection = { | ||
id: 'VariableCollectionId:334:16723', | ||
modes: [ | ||
{ | ||
name: 'new Mode', | ||
modeId: '123', | ||
}, | ||
], | ||
name: 'color', | ||
renameMode: mockRenameMode, | ||
} as unknown as VariableCollection; | ||
mockGetLocalVariableCollections.mockImplementationOnce(() => mockLocalVariableCollections); | ||
mockCreateVariableCollection.mockImplementationOnce(() => mockNewCollection); | ||
const selectedSets = [{ | ||
set: 'global', | ||
status: TokenSetStatus.ENABLED, | ||
}] | ||
expect(await createLocalVariablesWithoutModesInPlugin(tokens, settings, selectedSets)).toEqual({ | ||
allVariableCollectionIds: {}, | ||
totalVariables: 0, | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you not be able to re-use the
themeContainer
const on line 45 for this? I think thats what it was intended for?