Skip to content

Commit 3fa270a

Browse files
committedMar 13, 2025·
🎨: adjust render tests to work in non p3 envs
1 parent a64e09e commit 3fa270a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎lively.morphic/tests/text/rendering-test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global it, describe, beforeEach, afterEach */
1+
/* global it, describe, beforeEach, afterEach, CSS */
22
import { expect } from 'mocha-es6';
33
import { Text } from '../../text/morph.js';
44
import { Rectangle, Color, pt } from 'lively.graphics';
@@ -11,7 +11,7 @@ const defaultStyle = {
1111
fontWeight: 'normal',
1212
fontColor: Color.black,
1313
fontStyle: 'normal',
14-
textDecoration: 'none solid color(display-p3 0 0 0)'
14+
textDecoration: `none solid ${CSS.supports('color', 'color(display-p3 0 0 0)') ? 'color(display-p3 0 0 0)' : 'rgb(0,0,0)'}`
1515
};
1616

1717
let padding = Rectangle.inset(3);
@@ -72,7 +72,7 @@ describe('text rendering', () => {
7272
const visibleLines = 2;
7373
const paddingLines = 1;
7474
expect(textBounds.height).closeTo(lineHeight * (scrolledLines + visibleLines + paddingLines) + (padTop + padBot), 30, 'text layer does not have size of all lines');
75-
expect(node.querySelector('.newtext-text-layer.actual').textContent).lessThan(10111213, 'text layer renders more than necessary');
75+
expect(Number(node.querySelector('.newtext-text-layer.actual').textContent)).lessThan(10111213, 'text layer renders more than necessary');
7676
});
7777

7878
it('can resize on content change', async () => {

0 commit comments

Comments
 (0)
Please sign in to comment.