qc-trousse-sdg 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,19 +25,18 @@
25
25
  bind:this={button}
26
26
  {...rest}
27
27
  >
28
- <span class="qc-dropdown-text">
29
- {#if selectedOptionsText.length > 0}
30
- <span class="qc-dropdown-choice">{@html selectedOptionsText}</span>
31
- {:else}
32
- <span class="qc-dropdown-placeholder">{@html placeholder}</span>
33
- {/if}
34
- </span>
28
+ {#if selectedOptionsText.length > 0}
29
+ <span class="qc-dropdown-choice">{@html selectedOptionsText}</span>
30
+ {:else}
31
+ <span class="qc-dropdown-placeholder">{@html placeholder}</span>
32
+ {/if}
35
33
 
36
- <span class={["qc-dropdown-button-icon", expanded && "qc-dropdown-button-icon-expanded"]}>
34
+ <span class={["qc-dropdown-button-icon"]}>
37
35
  <Icon
38
36
  type="chevron-up-thin"
39
37
  color={disabled ? "grey-regular" : "blue-piv"}
40
38
  size="sm"
39
+ rotate={expanded ? 0 : 180}
41
40
  />
42
41
  </span>
43
42
  </button>
@@ -30,12 +30,6 @@ $min-height: 40;
30
30
  }
31
31
  }
32
32
 
33
- .qc-dropdown-text {
34
- display: flex;
35
- justify-items: start;
36
- overflow: hidden;
37
- }
38
-
39
33
  %dropdown-placeholder-text {
40
34
  display: block;
41
35
  justify-content: start;
@@ -56,10 +50,6 @@ $min-height: 40;
56
50
  }
57
51
 
58
52
  .qc-dropdown-button-icon {
59
- align-items: center;
60
- rotate: 180deg;
53
+ display: flex;
54
+ align-content: center;
61
55
  }
62
-
63
- .qc-dropdown-button-icon-expanded {
64
- transform: rotate(180deg);
65
- }
@@ -9,14 +9,14 @@
9
9
 
10
10
  let {
11
11
  label = '',
12
- required = $bindable(),
12
+ required = $bindable(false),
13
13
  description,
14
14
  size,
15
15
  maxlength,
16
16
  maxlengthReached = $bindable(false),
17
17
  invalidAtSubmit = $bindable(false),
18
- value = "",
19
- invalid = $bindable(),
18
+ value = $bindable(""),
19
+ invalid = $bindable(false),
20
20
  invalidText,
21
21
  describedBy = $bindable([]),
22
22
  labelElement = $bindable(),
@@ -71,6 +71,8 @@
71
71
  }
72
72
  })
73
73
 
74
+
75
+
74
76
  $effect(() => {
75
77
  charCountText = ''
76
78
  if (!maxlength) return;
@@ -107,8 +109,8 @@
107
109
  ].filter(Boolean)
108
110
  .join(' ')
109
111
  )
110
- if (invalid) input.setAttribute('aria-invalid', invalid)
111
- if (required) input.setAttribute('aria-required', required)
112
+ input.setAttribute('aria-invalid', invalid)
113
+ input.setAttribute('aria-required', required)
112
114
  })
113
115
 
114
116
  </script>
@@ -20,7 +20,7 @@
20
20
  setContext('webComponentMode', true)
21
21
 
22
22
  let {
23
- invalid,
23
+ invalid = $bindable(false),
24
24
  invalidText,
25
25
  label,
26
26
  description,
@@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';
2
2
  import path = require('path');
3
3
 
4
4
  test.beforeEach(async ({ page }) => {
5
- const htmlFilePath = path.resolve(__dirname, '../public/dropdownList.test.html');
5
+ const htmlFilePath = path.resolve(__dirname, '../public/dropdownListBaseline.test.html');
6
6
  await page.goto(`file://${htmlFilePath}`);
7
7
  });
8
8
 
@@ -0,0 +1,28 @@
1
+ import { test, expect } from '@playwright/test';
2
+ import path = require('path');
3
+
4
+ test.beforeEach(async ({ page }) => {
5
+ const htmlFilePath = path.resolve(__dirname, '../public/textFieldSvelte.test.html');
6
+ await page.goto(`file://${htmlFilePath}`);
7
+ })
8
+
9
+ /* test des composants web de la trousse */
10
+ test('textfield ref', {
11
+ tag: ['@svelte', '@textfield']
12
+ }, async ({ page }) => {
13
+ await expect(page).toHaveScreenshot('textField.png', {fullPage: true});
14
+ });
15
+
16
+ test.describe('Aria', () => {
17
+ test('aria-required', async ({ page }) => {
18
+ await expect(page.getByRole('textbox', { name: 'Large', exact: true })).toHaveAttribute('aria-required', 'true');
19
+ });
20
+
21
+ test('aria-invalid', async ({ page }) => {
22
+ await expect(page.getByRole('textbox', { name: 'Moyen', exact: true })).toHaveAttribute('aria-invalid', 'true');
23
+
24
+ await page.getByRole('textbox', { name: 'Moyen' }).click();
25
+ await page.getByRole('textbox', { name: 'Moyen' }).fill('1');
26
+ await expect(page.getByRole('textbox', { name: 'Moyen', exact: true })).toHaveAttribute('aria-invalid', 'false');
27
+ });
28
+ });
@@ -1,6 +1,11 @@
1
1
  import { test, expect } from '@playwright/test';
2
2
  import path = require('path');
3
3
 
4
+ test.beforeEach(async ({ page }) => {
5
+ const htmlFilePath = path.resolve(__dirname, '../public/textFieldBaseline.test.html');
6
+ await page.goto(`file://${htmlFilePath}`);
7
+ })
8
+
4
9
  /* test des composants web de la trousse */
5
10
  test('textfield ref', {
6
11
  tag: ['@baseline', '@textfield']
@@ -12,10 +17,21 @@ test('textfield ref', {
12
17
  });
13
18
  /* test des composants svelte */
14
19
  test('textfield svelte', {
15
- tag: ['@svelte', '@textfield']
20
+ tag: ['@baseline', '@textfield']
16
21
  }, async ({ page }) => {
17
- const htmlFilePath = path.resolve(__dirname, '../public/textFieldEmbedded.test.html');
18
- // Navigue vers le fichier en utilisant le protocole file://
19
- await page.goto(`file://${htmlFilePath}`);
20
- await expect(page).toHaveScreenshot('textField.png', {fullPage: true});
21
- });
22
+ await expect(page).toHaveScreenshot('textField.png', {fullPage: true});
23
+ });
24
+
25
+ test.describe('Aria', () => {
26
+ test('aria-required', async ({ page }) => {
27
+ await expect(page.getByRole('textbox', { name: 'Large', exact: true })).toHaveAttribute('aria-required', 'true');
28
+ });
29
+
30
+ test('aria-invalid', async ({ page }) => {
31
+ await expect(page.getByRole('textbox', { name: 'Moyen', exact: true })).toHaveAttribute('aria-invalid', 'true');
32
+
33
+ await page.getByRole('textbox', { name: 'Moyen' }).click();
34
+ await page.getByRole('textbox', { name: 'Moyen' }).fill('1');
35
+ await expect(page.getByRole('textbox', { name: 'Moyen', exact: true })).toHaveAttribute('aria-invalid', 'false');
36
+ });
37
+ });