-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1745 from tokens-studio/release-135_3
1.35.3
- Loading branch information
Showing
21 changed files
with
397 additions
and
101 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 was deleted.
Oops, something went wrong.
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,54 @@ | ||
import { AsyncMessageChannel } from '@/AsyncMessageChannel'; | ||
import { TokenSetStatus } from '@/constants/TokenSetStatus'; | ||
import { AsyncMessageTypes, GetThemeInfoMessageResult } from '@/types/AsyncMessages'; | ||
import renameStylesFromPlugin from './renameStylesFromPlugin'; | ||
|
||
describe('renameStylesFromPlugin', () => { | ||
figma.getLocalPaintStyles.mockReturnValue([ | ||
{ | ||
name: 'colors/old', | ||
id: '456', | ||
description: 'the red one', | ||
paints: [{ type: 'SOLID', color: { r: 1, g: 0, b: 0 }, opacity: 1 }], | ||
remove: jest.fn(), | ||
}, | ||
{ | ||
name: 'colors/blue', | ||
id: '567', | ||
description: 'the blue one', | ||
paints: [{ type: 'other', color: { r: 0, g: 0, b: 1 }, opacity: 0.5 }], | ||
remove: jest.fn(), | ||
}, | ||
{ | ||
name: 'colors/red', | ||
id: '678', | ||
description: 'the red one', | ||
paints: [{ type: 'other', color: { r: 0, g: 0, b: 1 }, opacity: 0.5 }], | ||
remove: jest.fn(), | ||
}, | ||
]); | ||
|
||
const runAfter: (() => void)[] = []; | ||
|
||
const mockGetThemeInfoHandler = async (): Promise<GetThemeInfoMessageResult> => ({ | ||
type: AsyncMessageTypes.GET_THEME_INFO, | ||
activeTheme: 'light', | ||
themes: [{ | ||
id: 'light', | ||
name: 'Light', | ||
selectedTokenSets: { | ||
global: TokenSetStatus.ENABLED, | ||
}, | ||
$figmaStyleReferences: {}, | ||
}], | ||
}); | ||
|
||
runAfter.push(AsyncMessageChannel.ReactInstance.connect()); | ||
AsyncMessageChannel.ReactInstance.handle(AsyncMessageTypes.GET_THEME_INFO, mockGetThemeInfoHandler); | ||
|
||
runAfter.push(AsyncMessageChannel.PluginInstance.connect()); | ||
|
||
it('should remove styles from plugin', async () => { | ||
expect(await renameStylesFromPlugin('global.colors.old', 'global.colors.new', 'global')).toEqual(['456']); | ||
}); | ||
}); |
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.