Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/web_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
working-directory: ./renderers/web_core
run: npm run build

- name: Run web_core tests
working-directory: ./renderers/web_core
run: npm test

- name: Install Lit renderer dependencies
working-directory: ./renderers/lit
run: npm i
Expand Down
9 changes: 8 additions & 1 deletion renderers/web_core/package.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll be adding screenshot tests to more robustly test this in some future changes, but in the meantime, can you add this new test command to .github/workflows/web_build_and_test.yml so that these get executed automatically?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test command added.

Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,16 @@
"prepack": "npm run build",
"build": "wireit",
"build:tsc": "wireit",
"copy-spec": "wireit"
"copy-spec": "wireit",
"test": "wireit"
},
"wireit": {
"test": {
"command": "node --test --enable-source-maps --test-reporter spec dist/src/v0_8/**/*.test.js",
"dependencies": [
"build"
]
},
"copy-spec": {
"command": "node scripts/copy-spec.js",
"files": [
Expand Down
18 changes: 18 additions & 0 deletions renderers/web_core/src/v0_8/styles/border.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import test from 'node:test';
import assert from 'node:assert';
import { border } from './border.js';

test('Border Styles', async (t) => {
await t.test('border-radius classes should not apply overflow: hidden to avoid text clipping', () => {
// The issue reported clipping of text when using rounded corners because
// .border-br-* generated classes also blindly applied overflow: hidden.

// Check if the generated CSS contains overflow: hidden for border-br classes
const match = border.match(/\.border-br-\w+ \{[^}]*overflow:\s*hidden/);
assert.strictEqual(match, null, 'Found overflow: hidden applied within a border-br-* class');

// Check that we DO have the expected border-radius applied
const hasBorderRadius = border.match(/\.border-br-1 \{ border-radius: [^;]+; \}/);
assert.notStrictEqual(hasBorderRadius, null, 'Missing border-radius in border-br-* class');
});
});
2 changes: 1 addition & 1 deletion renderers/web_core/src/v0_8/styles/border.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const border = `
.border-brw-${idx} { border-right-width: ${idx}px; }

.border-ow-${idx} { outline-width: ${idx}px; }
.border-br-${idx} { border-radius: ${idx * grid}px; overflow: hidden;}`;
.border-br-${idx} { border-radius: ${idx * grid}px; }`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Per the repository style guide, code changes should include tests. To prevent this text clipping issue from recurring, please consider adding a test case (e.g., a visual regression test) that verifies this fix.

References
  1. The repository style guide states: 'If there are code changes, code should have tests.' (link)

})
.join("\n")}

Expand Down