mirror of
https://github.com/penpot/penpot-plugins.git
synced 2025-01-04 13:50:13 -05:00
chore: added text test
This commit is contained in:
parent
58d83f00e8
commit
25211a618b
3 changed files with 2016 additions and 1644 deletions
File diff suppressed because it is too large
Load diff
|
@ -6,6 +6,7 @@ import group from './plugins/group';
|
|||
import insertSvg from './plugins/insert-svg';
|
||||
import pluginData from './plugins/plugin-data';
|
||||
import componentLibrary from './plugins/component-library';
|
||||
import createText from './plugins/create-text';
|
||||
|
||||
describe('Plugins', () => {
|
||||
it('create frame - text - rectable', async () => {
|
||||
|
@ -49,4 +50,10 @@ describe('Plugins', () => {
|
|||
const result = await agent.runCode(componentLibrary.toString());
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('text and textrange', async () => {
|
||||
const agent = await Agent();
|
||||
const result = await agent.runCode(createText.toString());
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
22
apps/e2e/src/plugins/create-text.ts
Normal file
22
apps/e2e/src/plugins/create-text.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
export default function () {
|
||||
function createText(): void {
|
||||
const text = penpot.createText('Hello World!');
|
||||
|
||||
if (text) {
|
||||
text.growType = 'auto-width';
|
||||
text.textTransform = 'uppercase';
|
||||
text.textDecoration = 'underline';
|
||||
text.fontId = 'gfont-work-sans';
|
||||
text.fontStyle = 'italic';
|
||||
text.fontSize = '20';
|
||||
text.fontWeight = '500';
|
||||
|
||||
const textRange = text.getRange(0, 5);
|
||||
textRange.fontSize = '40';
|
||||
textRange.fills = [{ fillColor: '#ff6fe0', fillOpacity: 1 }];
|
||||
}
|
||||
}
|
||||
|
||||
createText();
|
||||
}
|
||||
|
Loading…
Reference in a new issue