-
Notifications
You must be signed in to change notification settings - Fork 819
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support rendering into wrapped object (#379)
* support rendering into wrapped object * update some docs * add e2e test for rendering into wrapped object * update deps and use prettier instead of prettier-cli (#380) * update deps and use prettier instead of prettier-cli * remove e2e tests on ci for now
- Loading branch information
1 parent
08f3904
commit 37148bf
Showing
75 changed files
with
867 additions
and
601 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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* eslint-disable import/named, import/no-unresolved */ | ||
import * as React from 'react'; | ||
import * as sketch from 'sketch'; | ||
import { render, View, Artboard, Text } from '../../src'; | ||
|
||
// depending on where those tests run, we don't get the things, | ||
// eg. the context might be empty or there is no selected document | ||
// This make sure we always get something | ||
function getDoc(document) { | ||
return sketch.getSelectedDocument() || document; | ||
} | ||
|
||
const colorList = { | ||
Haus: '#F3F4F4', | ||
Night: '#333', | ||
Sur: '#96DBE4', | ||
'Sur Dark': '#24828F', | ||
Peach: '#EFADA0', | ||
'Peach Dark': '#E37059', | ||
Pear: '#93DAAB', | ||
'Pear Dark': '#2E854B', | ||
}; | ||
|
||
test('should render a Page with a rectangle', (context, document) => { | ||
const { selectedPage } = getDoc(document); | ||
// eslint-disable-next-line | ||
const Swatch = ({ name, hex }) => ( | ||
<View | ||
name={`Swatch ${name}`} | ||
style={{ | ||
height: 96, | ||
width: 96, | ||
margin: 4, | ||
backgroundColor: hex, | ||
padding: 8, | ||
}} | ||
> | ||
<Text name="Swatch Name" style={{ color: '#000', fontWeight: 'bold' }}> | ||
{name} | ||
</Text> | ||
<Text name="Swatch Hex" style={{ color: '#000' }}> | ||
{hex} | ||
</Text> | ||
</View> | ||
); | ||
|
||
render( | ||
<Artboard | ||
name="Swatches" | ||
style={{ | ||
flexDirection: 'row', | ||
flexWrap: 'wrap', | ||
width: (96 + 8) * 4, | ||
}} | ||
> | ||
{Object.keys(colorList).map(color => ( | ||
<Swatch name={color} hex={colorList[color]} key={color} /> | ||
))} | ||
</Artboard>, | ||
selectedPage, | ||
); | ||
|
||
expect(selectedPage.layers[0].name).toBe('Swatches'); | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.