Svelte NodeToolbar with E2E (#3643)
* Added NodeToolbar * Added comments & fixed default behaviour in svelte * Added e2e-tests for NodeToolbar component & added data-id to react NodeToolbar * refactor(svelte/NodeToolbar): cleanup * refactor(node-toolbar): add system utils --------- Co-authored-by: moklick <info@moritzklack.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const MATCH_ALL_NUMBERS = /[\d\.]+/g;
|
||||
|
||||
// Type "Locator" not exported...
|
||||
export async function getTransform(element) {
|
||||
const transformString = await element.evaluate((el) => {
|
||||
return el.style.transform;
|
||||
});
|
||||
|
||||
// Parses all numbers in f.ex "translate(590px, 324px) scale(2)""
|
||||
const transforms = transformString.match(MATCH_ALL_NUMBERS);
|
||||
return {
|
||||
translateX: parseFloat(transforms![0]),
|
||||
translateY: parseFloat(transforms![1]),
|
||||
scale: parseFloat(transforms![2]),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user