Skip to content

Commit

Permalink
🎨: adjust render tests to work in non p3 envs
Browse files Browse the repository at this point in the history
  • Loading branch information
merryman committed Feb 7, 2025
1 parent 936bd22 commit 180c15a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lively.morphic/tests/text/rendering-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global it, describe, beforeEach, afterEach */
/* global it, describe, beforeEach, afterEach, CSS */
import { expect } from 'mocha-es6';
import { Text } from '../../text/morph.js';
import { Rectangle, Color, pt } from 'lively.graphics';
Expand All @@ -11,7 +11,7 @@ const defaultStyle = {
fontWeight: 'normal',
fontColor: Color.black,
fontStyle: 'normal',
textDecoration: 'none solid color(display-p3 0 0 0)'
textDecoration: `none solid ${CSS.supports('color', 'color(display-p3 0 0 0)') ? 'color(display-p3 0 0 0)' : 'rgb(0,0,0)'}`
};

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

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

0 comments on commit 180c15a

Please sign in to comment.