Skip to content

Commit 83b2fb4

Browse files
committed
test: minor realignements and fixes
1 parent 8bd82a3 commit 83b2fb4

File tree

13 files changed

+68
-36
lines changed

13 files changed

+68
-36
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// import { common } from './all-features.js';
1+
import { common } from './all-features.js';
22

3-
// common({
4-
// url: '/test-2/',
5-
// system: 'shoelace',
6-
// });
3+
common({
4+
url: '/test-2/',
5+
system: 'shoelace',
6+
});

e2e/tests/all-features.visibility.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import type { System } from './all-features.js';
44

55
import AxeBuilder from '@axe-core/playwright';
66

7+
// NOTE: getByLabel does not find text if text is "slotted"
8+
// (https://github.com/microsoft/playwright/issues/35715)
9+
710
export function visibility({
811
url,
912
system: theme,
@@ -18,7 +21,7 @@ export function visibility({
1821
await page.goto(url); // 3
1922

2023
const accessibilityScanResults = await new AxeBuilder({ page })
21-
.include('jsf-generic')
24+
.include('jsf-generic, jsf-webawesome')
2225
.analyze();
2326

2427
expect(accessibilityScanResults.violations).toEqual([]);
@@ -78,7 +81,8 @@ export function visibility({
7881
await expect(page.getByLabel('Range with constraints')).toBeVisible();
7982

8083
if (theme === 'shoelace') {
81-
await expect(page.getByLabel('Rating')).toBeVisible();
84+
// FIXME:
85+
// await expect(page.getByLabel('Rating')).toBeVisible();
8286
}
8387

8488
// MARK: Booleans
@@ -142,7 +146,14 @@ export function visibility({
142146

143147
// Fixed array
144148
await expect(page.getByLabel('A number')).toBeVisible();
145-
await expect(page.getByLabel('A boolean')).toBeVisible();
149+
150+
if (theme === 'shoelace') {
151+
await expect(
152+
page.getByRole('checkbox', { name: 'A boolean' }),
153+
).toBeVisible();
154+
} else {
155+
await expect(page.getByLabel('A boolean')).toBeVisible();
156+
}
146157
await expect(page.getByLabel('A date')).toBeVisible();
147158

148159
// FIXME:

example-app/src/fixtures/all-features.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const schema = {
7373
type: 'string',
7474
minLength: 100,
7575
maxLength: 1200,
76+
default: 'Default value',
7677
},
7778
Color: {
7879
title: 'Color picker',
@@ -498,6 +499,7 @@ export const data = {
498499
Strings: {
499500
Password: 'Science avec patience',
500501
Email: 'foo@bar.home.arpa',
502+
// TextArea: 'Prefilled value',
501503
},
502504

503505
Booleans: {
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
import { JsfeFormGeneric } from '@jsfe/generics';
1+
import { JsonSchemaFormGeneric } from '@jsfe/generics/elements';
22
import { unsafeCSS, css } from 'lit';
33
import picoStyles from '@picocss/pico?inline';
44

5-
JsfeFormGeneric.styles.push(unsafeCSS(picoStyles));
6-
JsfeFormGeneric.styles.push(
7-
unsafeCSS(css`
8-
/* DEBUG */
9-
*:focus {
10-
outline: 2px solid red !important;
11-
}
12-
`),
13-
);
14-
JsfeFormGeneric.define();
5+
(class extends JsonSchemaFormGeneric {
6+
static override styles = [
7+
unsafeCSS(picoStyles),
8+
css`
9+
/* DEBUG */
10+
*:focus {
11+
outline: 3px solid yellow !important;
12+
}
13+
:host {
14+
font-size: inherit;
15+
}
16+
`,
17+
];
18+
}).define();

example-app/src/routes/test-1.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
body {
44
background: var(--pico-background-color);
55
}
6+
7+
html {
8+
font-size: 12px;
9+
}

example-app/src/routes/test-1.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { defineRoute } from '@gracile/gracile/route';
22
import { html } from '@gracile/gracile/server-html';
33

44
import { document } from '../document.js';
5-
import { LitElement } from 'lit';
6-
import { customElement } from 'lit/decorators.js';
75

86
// import '@jsfe/webawesome';
97
import './test-1.client.js';

example-app/src/routes/test-2.client.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import '@jsfe/webawesome';
1+
import { JsonSchemaFormWebawesome } from '@jsfe/webawesome';
2+
import styles from '@jsfe/webawesome/css?inline';
23

34
import '@shoelace-style/shoelace/dist/components/input/input.js';
45
import '@shoelace-style/shoelace/dist/components/textarea/textarea.js';
@@ -31,3 +32,11 @@ import '@shoelace-style/shoelace/dist/components/icon/icon.js';
3132
import '@shoelace-style/shoelace/dist/components/divider/divider.js';
3233
import '@shoelace-style/shoelace/dist/components/button-group/button-group.js';
3334
import '@shoelace-style/shoelace/dist/components/tooltip/tooltip.js';
35+
import { unsafeCSS } from 'lit';
36+
37+
(class extends JsonSchemaFormWebawesome {
38+
static override styles = [unsafeCSS(styles)];
39+
}).define();
40+
41+
JsonSchemaFormWebawesome.define();
42+
console.log({ styles: JsonSchemaFormWebawesome.styles });

example-app/src/routes/test-2.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '@jsfe/webawesome/css';
1+
/* @import '@jsfe/webawesome/css'; */
22

33
body {
44
/* display: none; */

example-app/src/routes/test-2.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ import { html } from '@gracile/gracile/server-html';
33

44
import { document } from '../document.js';
55

6-
import '@jsfe/webawesome';
76
import { schema, data, ui } from '../fixtures/all-features.js';
7+
import { JsonSchemaFormWebawesome } from '@jsfe/webawesome';
8+
import { unsafeCSS } from 'lit';
9+
10+
import styles from '@jsfe/webawesome/css?inline';
11+
12+
(class extends JsonSchemaFormWebawesome {
13+
static override styles = [unsafeCSS(styles)];
14+
}).define();
815

916
export default defineRoute({
1017
handler: {

packages/engine/src/tests/engine.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void describe('JSONSchemaFormEngine', () => {
140140
target: numberInput,
141141
type: 'input',
142142
} as unknown as InputEvent;
143-
form.handleFormEvent(numberEvent, true);
143+
form.handleFormEvent(numberEvent /* true */);
144144
assert.strictEqual(
145145
form.data.age,
146146
25,

0 commit comments

Comments
 (0)