@noctuatech/uswds 1.3.3 → 1.3.4
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.
- package/package.json +5 -5
- package/src/lib/accordion/{accordion.test.ts → accordion.element.test.ts} +28 -31
- package/src/lib/accordion/accordion.element.ts +9 -7
- package/src/lib/alert/{alert.test.ts → alert.element.test.ts} +5 -6
- package/src/lib/alert/alert.element.ts +6 -4
- package/src/lib/breadcrumbs/breadcrumb/breadcrumb.element.ts +10 -10
- package/src/lib/breadcrumbs/breadcrumbs.element.test.ts +23 -0
- package/src/lib/button/button.element.test.ts +15 -0
- package/src/lib/button/button.element.ts +37 -42
- package/src/lib/button-group/button-group.element.test.ts +13 -0
- package/src/lib/card/{card.test.ts → card.element.test.ts} +12 -12
- package/src/lib/checkbox/{checkbox.test.ts → checkbox.element.test.ts} +15 -17
- package/src/lib/checkbox/checkbox.element.ts +28 -32
- package/src/lib/checkbox/checkbox.stories.ts +17 -33
- package/src/lib/collection/collection-item/collection-item.element.test.ts +15 -0
- package/src/lib/collection/collection.element.test.ts +13 -0
- package/src/lib/combo-box/{combo-box.test.ts → combo-box.element.test.ts} +64 -93
- package/src/lib/config/config.element.test.ts +13 -0
- package/src/lib/description/description.element.test.ts +13 -0
- package/src/lib/file-input/file-input-preview/file-input-preview.element.test.ts +93 -0
- package/src/lib/file-input/file-input-preview/file-input-preview.element.ts +15 -13
- package/src/lib/file-input/file-input.element.test.ts +73 -0
- package/src/lib/file-input/file-input.element.ts +10 -20
- package/src/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.ts +20 -20
- package/src/lib/in-page-nav/{in-page-nav.test.ts → in-page-nav.element.test.ts} +18 -21
- package/src/lib/input/input.element.ts +56 -37
- package/src/lib/input-mask/input-mask.element.ts +1 -1
- package/src/lib/input-mask/input-mask.stories.ts +2 -0
- package/src/lib/link/link.element.ts +18 -25
- package/src/lib/modal/modal-close/modal-close.element.test.ts +13 -0
- package/src/lib/modal/modal-heading/modal-heading.element.test.ts +15 -0
- package/src/lib/modal/modal.element.test.ts +23 -0
- package/src/lib/pagination/pagination-item/pagination-item.element.ts +9 -6
- package/src/lib/pagination/pagination-no/pagination-no.element.ts +17 -17
- package/src/lib/pagination/pagination.element.test.ts +13 -0
- package/src/lib/process-list/{process-list.test.ts → process-list.element.test.ts} +19 -12
- package/src/lib/radio/radio-option/radio-option.element.test.ts +20 -0
- package/src/lib/radio/radio.element.test.ts +121 -0
- package/src/lib/range-slider/range-slider.element.test.ts +57 -0
- package/src/lib/range-slider/range-slider.element.ts +48 -33
- package/src/lib/search/search.element.test.ts +71 -0
- package/src/lib/select/{select.test.ts → select.element.test.ts} +23 -26
- package/src/lib/select/select.element.ts +31 -32
- package/src/lib/side-nav/{side-nav.test.ts → side-nav.element.test.ts} +13 -23
- package/src/lib/step-indicator/step/step.element.ts +16 -16
- package/src/lib/step-indicator/{step-indicator.test.ts → step-indicator.element.test.ts} +6 -6
- package/src/lib/summary-box/summary-box.element.test.ts +13 -0
- package/src/lib/tag/tag.element.test.ts +13 -0
- package/src/lib/textarea/{textarea.test.ts → textarea.element.test.ts} +13 -13
- package/src/lib/textarea/textarea.element.ts +22 -19
- package/target/lib/accordion/accordion.element.js +4 -2
- package/target/lib/accordion/accordion.element.js.map +1 -1
- package/target/lib/accordion/accordion.element.test.d.ts +1 -0
- package/target/lib/accordion/{accordion.test.js → accordion.element.test.js} +19 -19
- package/target/lib/accordion/accordion.element.test.js.map +1 -0
- package/target/lib/alert/alert.element.js +4 -2
- package/target/lib/alert/alert.element.js.map +1 -1
- package/target/lib/alert/alert.element.test.d.ts +1 -0
- package/target/lib/alert/{alert.test.js → alert.element.test.js} +5 -5
- package/target/lib/alert/alert.element.test.js.map +1 -0
- package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.d.ts +1 -1
- package/target/lib/breadcrumbs/breadcrumb/breadcrumb.element.js +6 -6
- package/target/lib/breadcrumbs/breadcrumbs.element.test.d.ts +2 -0
- package/target/lib/breadcrumbs/{breadcrumbs.test.js → breadcrumbs.element.test.js} +6 -6
- package/target/lib/breadcrumbs/breadcrumbs.element.test.js.map +1 -0
- package/target/lib/button/button.element.d.ts +3 -3
- package/target/lib/button/button.element.js +17 -23
- package/target/lib/button/button.element.js.map +1 -1
- package/target/lib/button/button.element.test.d.ts +1 -0
- package/target/lib/button/button.element.test.js +12 -0
- package/target/lib/button/button.element.test.js.map +1 -0
- package/target/lib/button-group/button-group.element.test.d.ts +1 -0
- package/target/lib/button-group/button-group.element.test.js +9 -0
- package/target/lib/button-group/button-group.element.test.js.map +1 -0
- package/target/lib/card/card.element.test.d.ts +6 -0
- package/target/lib/card/{card.test.js → card.element.test.js} +10 -10
- package/target/lib/card/card.element.test.js.map +1 -0
- package/target/lib/checkbox/checkbox.element.d.ts +3 -2
- package/target/lib/checkbox/checkbox.element.js +21 -22
- package/target/lib/checkbox/checkbox.element.js.map +1 -1
- package/target/lib/checkbox/checkbox.element.test.d.ts +1 -0
- package/target/lib/checkbox/{checkbox.test.js → checkbox.element.test.js} +13 -12
- package/target/lib/checkbox/checkbox.element.test.js.map +1 -0
- package/target/lib/checkbox/checkbox.stories.d.ts +2 -2
- package/target/lib/checkbox/checkbox.stories.js +6 -6
- package/target/lib/checkbox/checkbox.stories.js.map +1 -1
- package/target/lib/collection/collection-item/collection-item.element.test.d.ts +1 -0
- package/target/lib/collection/collection-item/collection-item.element.test.js +9 -0
- package/target/lib/collection/collection-item/collection-item.element.test.js.map +1 -0
- package/target/lib/collection/collection.element.test.d.ts +1 -0
- package/target/lib/collection/collection.element.test.js +9 -0
- package/target/lib/collection/collection.element.test.js.map +1 -0
- package/target/lib/combo-box/combo-box.element.test.d.ts +3 -0
- package/target/lib/combo-box/{combo-box.test.js → combo-box.element.test.js} +60 -60
- package/target/lib/combo-box/combo-box.element.test.js.map +1 -0
- package/target/lib/config/config.element.test.d.ts +1 -0
- package/target/lib/config/config.element.test.js +9 -0
- package/target/lib/config/config.element.test.js.map +1 -0
- package/target/lib/description/description.element.test.d.ts +1 -0
- package/target/lib/description/description.element.test.js +9 -0
- package/target/lib/description/description.element.test.js.map +1 -0
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js +12 -10
- package/target/lib/file-input/file-input-preview/file-input-preview.element.js.map +1 -1
- package/target/lib/file-input/file-input-preview/file-input-preview.element.test.d.ts +2 -0
- package/target/lib/file-input/file-input-preview/{file-input-preview.test.js → file-input-preview.element.test.js} +24 -24
- package/target/lib/file-input/file-input-preview/file-input-preview.element.test.js.map +1 -0
- package/target/lib/file-input/file-input.element.js +5 -6
- package/target/lib/file-input/file-input.element.js.map +1 -1
- package/target/lib/file-input/file-input.element.test.d.ts +1 -0
- package/target/lib/file-input/{file-input.test.js → file-input.element.test.js} +16 -16
- package/target/lib/file-input/file-input.element.test.js.map +1 -0
- package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.d.ts +2 -3
- package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js +15 -13
- package/target/lib/in-page-nav/in-page-nav-item/in-page-nav-item.element.js.map +1 -1
- package/target/lib/in-page-nav/in-page-nav.element.test.d.ts +2 -0
- package/target/lib/in-page-nav/{in-page-nav.test.js → in-page-nav.element.test.js} +6 -6
- package/target/lib/in-page-nav/in-page-nav.element.test.js.map +1 -0
- package/target/lib/input/input.element.d.ts +4 -5
- package/target/lib/input/input.element.js +55 -127
- package/target/lib/input/input.element.js.map +1 -1
- package/target/lib/input/{input.test.js → input.element.test.js} +6 -26
- package/target/lib/input/input.element.test.js.map +1 -0
- package/target/lib/input-mask/input-mask.element.d.ts +1 -1
- package/target/lib/input-mask/input-mask.element.js +1 -1
- package/target/lib/input-mask/input-mask.element.js.map +1 -1
- package/target/lib/input-mask/{input-mask.test.js → input-mask.element.test.js} +1 -1
- package/target/lib/input-mask/input-mask.element.test.js.map +1 -0
- package/target/lib/input-mask/input-mask.stories.js +1 -1
- package/target/lib/input-mask/input-mask.stories.js.map +1 -1
- package/target/lib/link/link.element.d.ts +3 -5
- package/target/lib/link/link.element.js +14 -26
- package/target/lib/link/link.element.js.map +1 -1
- package/target/lib/modal/modal-close/modal-close.element.test.d.ts +1 -0
- package/target/lib/modal/modal-close/modal-close.element.test.js +9 -0
- package/target/lib/modal/modal-close/modal-close.element.test.js.map +1 -0
- package/target/lib/modal/modal-heading/modal-heading.element.test.d.ts +1 -0
- package/target/lib/modal/modal-heading/modal-heading.element.test.js +9 -0
- package/target/lib/modal/modal-heading/modal-heading.element.test.js.map +1 -0
- package/target/lib/modal/modal.element.test.d.ts +3 -0
- package/target/lib/modal/modal.element.test.js +11 -0
- package/target/lib/modal/modal.element.test.js.map +1 -0
- package/target/lib/pagination/pagination-item/pagination-item.element.d.ts +1 -1
- package/target/lib/pagination/pagination-item/pagination-item.element.js +3 -3
- package/target/lib/pagination/pagination-item/pagination-item.element.js.map +1 -1
- package/target/lib/pagination/pagination-no/pagination-no.element.d.ts +2 -3
- package/target/lib/pagination/pagination-no/pagination-no.element.js +10 -8
- package/target/lib/pagination/pagination-no/pagination-no.element.js.map +1 -1
- package/target/lib/pagination/pagination.element.test.d.ts +1 -0
- package/target/lib/pagination/pagination.element.test.js +9 -0
- package/target/lib/pagination/pagination.element.test.js.map +1 -0
- package/target/lib/process-list/process-list.element.test.d.ts +2 -0
- package/target/lib/process-list/{process-list.test.js → process-list.element.test.js} +6 -6
- package/target/lib/process-list/process-list.element.test.js.map +1 -0
- package/target/lib/radio/radio-option/radio-option.element.test.d.ts +2 -0
- package/target/lib/radio/radio-option/radio-option.element.test.js +11 -0
- package/target/lib/radio/radio-option/radio-option.element.test.js.map +1 -0
- package/target/lib/radio/radio.element.test.d.ts +2 -0
- package/target/lib/radio/{radio.test.js → radio.element.test.js} +19 -28
- package/target/lib/radio/radio.element.test.js.map +1 -0
- package/target/lib/range-slider/range-slider.element.d.ts +4 -2
- package/target/lib/range-slider/range-slider.element.js +34 -29
- package/target/lib/range-slider/range-slider.element.js.map +1 -1
- package/target/lib/range-slider/range-slider.element.test.d.ts +1 -0
- package/target/lib/range-slider/range-slider.element.test.js +26 -0
- package/target/lib/range-slider/range-slider.element.test.js.map +1 -0
- package/target/lib/search/search.element.test.d.ts +3 -0
- package/target/lib/search/search.element.test.js +52 -0
- package/target/lib/search/search.element.test.js.map +1 -0
- package/target/lib/select/select.element.d.ts +4 -3
- package/target/lib/select/select.element.js +25 -26
- package/target/lib/select/select.element.js.map +1 -1
- package/target/lib/select/select.element.test.d.ts +2 -0
- package/target/lib/select/{select.test.js → select.element.test.js} +23 -27
- package/target/lib/select/select.element.test.js.map +1 -0
- package/target/lib/services/{icon.service.test.js → icon.service.element.test.js} +1 -1
- package/target/lib/services/icon.service.element.test.js.map +1 -0
- package/target/lib/side-nav/side-nav.element.test.d.ts +3 -0
- package/target/lib/side-nav/{side-nav.test.js → side-nav.element.test.js} +11 -11
- package/target/lib/side-nav/side-nav.element.test.js.map +1 -0
- package/target/lib/step-indicator/step/step.element.d.ts +2 -2
- package/target/lib/step-indicator/step/step.element.js +8 -8
- package/target/lib/step-indicator/step-indicator.element.test.d.ts +2 -0
- package/target/lib/step-indicator/{step-indicator.test.js → step-indicator.element.test.js} +6 -6
- package/target/lib/step-indicator/step-indicator.element.test.js.map +1 -0
- package/target/lib/summary-box/summary-box.element.test.d.ts +1 -0
- package/target/lib/summary-box/summary-box.element.test.js +9 -0
- package/target/lib/summary-box/summary-box.element.test.js.map +1 -0
- package/target/lib/tag/tag.element.test.d.ts +1 -0
- package/target/lib/tag/tag.element.test.js +9 -0
- package/target/lib/tag/tag.element.test.js.map +1 -0
- package/target/lib/textarea/textarea.element.d.ts +2 -2
- package/target/lib/textarea/textarea.element.js +19 -24
- package/target/lib/textarea/textarea.element.js.map +1 -1
- package/target/lib/textarea/textarea.element.test.d.ts +1 -0
- package/target/lib/textarea/{textarea.test.js → textarea.element.test.js} +14 -14
- package/target/lib/textarea/textarea.element.test.js.map +1 -0
- package/src/lib/breadcrumbs/breadcrumbs.test.ts +0 -21
- package/src/lib/button/button.test.ts +0 -17
- package/src/lib/button-group/button-group.test.ts +0 -15
- package/src/lib/collection/collection-item/collection-item.test.ts +0 -15
- package/src/lib/collection/collection.test.ts +0 -15
- package/src/lib/config/config.test.ts +0 -15
- package/src/lib/description/description.test.ts +0 -15
- package/src/lib/file-input/file-input-preview/file-input-preview.test.ts +0 -95
- package/src/lib/file-input/file-input.test.ts +0 -79
- package/src/lib/modal/modal-close/modal-close.test.ts +0 -15
- package/src/lib/modal/modal-heading/modal-heading.test.ts +0 -15
- package/src/lib/modal/modal.test.ts +0 -25
- package/src/lib/pagination/pagination.test.ts +0 -15
- package/src/lib/radio/radio-option/radio-option.test.ts +0 -20
- package/src/lib/radio/radio.test.ts +0 -174
- package/src/lib/range-slider/range-slider.test.ts +0 -52
- package/src/lib/search/search.test.ts +0 -81
- package/src/lib/summary-box/summary-box.test.ts +0 -15
- package/src/lib/tag/tag.test.ts +0 -15
- package/target/lib/accordion/accordion.test.d.ts +0 -1
- package/target/lib/accordion/accordion.test.js.map +0 -1
- package/target/lib/alert/alert.test.d.ts +0 -1
- package/target/lib/alert/alert.test.js.map +0 -1
- package/target/lib/breadcrumbs/breadcrumbs.test.d.ts +0 -2
- package/target/lib/breadcrumbs/breadcrumbs.test.js.map +0 -1
- package/target/lib/button/button.test.d.ts +0 -1
- package/target/lib/button/button.test.js +0 -12
- package/target/lib/button/button.test.js.map +0 -1
- package/target/lib/button-group/button-group.test.d.ts +0 -1
- package/target/lib/button-group/button-group.test.js +0 -9
- package/target/lib/button-group/button-group.test.js.map +0 -1
- package/target/lib/card/card.test.d.ts +0 -6
- package/target/lib/card/card.test.js.map +0 -1
- package/target/lib/checkbox/checkbox.test.d.ts +0 -1
- package/target/lib/checkbox/checkbox.test.js.map +0 -1
- package/target/lib/collection/collection-item/collection-item.test.d.ts +0 -1
- package/target/lib/collection/collection-item/collection-item.test.js +0 -9
- package/target/lib/collection/collection-item/collection-item.test.js.map +0 -1
- package/target/lib/collection/collection.test.d.ts +0 -1
- package/target/lib/collection/collection.test.js +0 -9
- package/target/lib/collection/collection.test.js.map +0 -1
- package/target/lib/combo-box/combo-box.test.d.ts +0 -3
- package/target/lib/combo-box/combo-box.test.js.map +0 -1
- package/target/lib/config/config.test.d.ts +0 -1
- package/target/lib/config/config.test.js +0 -9
- package/target/lib/config/config.test.js.map +0 -1
- package/target/lib/description/description.test.d.ts +0 -1
- package/target/lib/description/description.test.js +0 -9
- package/target/lib/description/description.test.js.map +0 -1
- package/target/lib/file-input/file-input-preview/file-input-preview.test.d.ts +0 -2
- package/target/lib/file-input/file-input-preview/file-input-preview.test.js.map +0 -1
- package/target/lib/file-input/file-input.test.d.ts +0 -1
- package/target/lib/file-input/file-input.test.js.map +0 -1
- package/target/lib/in-page-nav/in-page-nav.test.d.ts +0 -2
- package/target/lib/in-page-nav/in-page-nav.test.js.map +0 -1
- package/target/lib/input/input.test.js.map +0 -1
- package/target/lib/input-mask/input-mask.test.js.map +0 -1
- package/target/lib/modal/modal-close/modal-close.test.d.ts +0 -1
- package/target/lib/modal/modal-close/modal-close.test.js +0 -9
- package/target/lib/modal/modal-close/modal-close.test.js.map +0 -1
- package/target/lib/modal/modal-heading/modal-heading.test.d.ts +0 -1
- package/target/lib/modal/modal-heading/modal-heading.test.js +0 -9
- package/target/lib/modal/modal-heading/modal-heading.test.js.map +0 -1
- package/target/lib/modal/modal.test.d.ts +0 -3
- package/target/lib/modal/modal.test.js +0 -11
- package/target/lib/modal/modal.test.js.map +0 -1
- package/target/lib/pagination/pagination.test.d.ts +0 -1
- package/target/lib/pagination/pagination.test.js +0 -9
- package/target/lib/pagination/pagination.test.js.map +0 -1
- package/target/lib/process-list/process-list.test.d.ts +0 -2
- package/target/lib/process-list/process-list.test.js.map +0 -1
- package/target/lib/radio/radio-option/radio-option.test.d.ts +0 -2
- package/target/lib/radio/radio-option/radio-option.test.js +0 -11
- package/target/lib/radio/radio-option/radio-option.test.js.map +0 -1
- package/target/lib/radio/radio.test.d.ts +0 -2
- package/target/lib/radio/radio.test.js.map +0 -1
- package/target/lib/range-slider/range-slider.test.d.ts +0 -1
- package/target/lib/range-slider/range-slider.test.js +0 -25
- package/target/lib/range-slider/range-slider.test.js.map +0 -1
- package/target/lib/search/search.test.d.ts +0 -3
- package/target/lib/search/search.test.js +0 -52
- package/target/lib/search/search.test.js.map +0 -1
- package/target/lib/select/select.test.d.ts +0 -2
- package/target/lib/select/select.test.js.map +0 -1
- package/target/lib/services/icon.service.test.js.map +0 -1
- package/target/lib/side-nav/side-nav.test.d.ts +0 -3
- package/target/lib/side-nav/side-nav.test.js.map +0 -1
- package/target/lib/step-indicator/step-indicator.test.d.ts +0 -2
- package/target/lib/step-indicator/step-indicator.test.js.map +0 -1
- package/target/lib/summary-box/summary-box.test.d.ts +0 -1
- package/target/lib/summary-box/summary-box.test.js +0 -9
- package/target/lib/summary-box/summary-box.test.js.map +0 -1
- package/target/lib/tag/tag.test.d.ts +0 -1
- package/target/lib/tag/tag.test.js +0 -9
- package/target/lib/tag/tag.test.js.map +0 -1
- package/target/lib/textarea/textarea.test.d.ts +0 -1
- package/target/lib/textarea/textarea.test.js.map +0 -1
- /package/src/lib/input/{input.test.ts → input.element.test.ts} +0 -0
- /package/src/lib/input-mask/{input-mask.test.ts → input-mask.element.test.ts} +0 -0
- /package/src/lib/services/{icon.service.test.ts → icon.service.element.test.ts} +0 -0
- /package/target/lib/input/{input.test.d.ts → input.element.test.d.ts} +0 -0
- /package/target/lib/input-mask/{input-mask.test.d.ts → input-mask.element.test.d.ts} +0 -0
- /package/target/lib/services/{icon.service.test.d.ts → icon.service.element.test.d.ts} +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import '@joist/templating/define.js';
|
|
3
|
+
import { attr, css, element, html, listen, query } from '@joist/element';
|
|
4
|
+
import { effect } from '@joist/observable';
|
|
5
|
+
import { bind } from '@joist/templating';
|
|
4
6
|
let USATextareaElement = (() => {
|
|
5
7
|
let _classDecorators = [element({
|
|
6
8
|
tagName: 'usa-textarea',
|
|
7
9
|
shadowDom: [
|
|
8
10
|
css `*{box-sizing:border-box}:host{font-size:1.06rem;line-height:1.3;display:flex;flex-direction:column;font-weight:400;margin-bottom:1.5rem;max-width:30rem;position:relative;height:9lh;gap:.5rem}textarea{font-family:inherit;font-size:inherit;border-radius:0;color:#1b1b1b;display:block;padding:.5rem;border-width:1px;border-color:#5c5c5c;border-style:solid;background-color:#fff;-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;resize:none;flex-grow:1}textarea:not(:disabled):focus{outline:.25rem solid #2491ff;outline-offset:0}textarea:disabled{background-color:#fff;border-color:#757575;color:#757575}`,
|
|
9
|
-
html `<
|
|
11
|
+
html `<j-bind attrs="for:name"><label part="label"><slot></slot></label></j-bind><j-bind props="name,placeholder,autocomplete,required,value,id:name"><textarea id="textarea" part="textarea"></textarea></j-bind>`,
|
|
10
12
|
],
|
|
11
13
|
})];
|
|
12
14
|
let _classDescriptor;
|
|
@@ -26,32 +28,34 @@ let USATextareaElement = (() => {
|
|
|
26
28
|
let _required_decorators;
|
|
27
29
|
let _required_initializers = [];
|
|
28
30
|
let _required_extraInitializers = [];
|
|
31
|
+
let _autofocus_decorators;
|
|
32
|
+
let _autofocus_initializers = [];
|
|
33
|
+
let _autofocus_extraInitializers = [];
|
|
29
34
|
let _value_decorators;
|
|
30
35
|
let _value_initializers = [];
|
|
31
36
|
let _value_extraInitializers = [];
|
|
32
|
-
let _onReady_decorators;
|
|
33
37
|
let _onChange_decorators;
|
|
34
38
|
let _onInputChange_decorators;
|
|
35
39
|
var USATextareaElement = class extends _classSuper {
|
|
36
40
|
static { _classThis = this; }
|
|
37
41
|
static {
|
|
38
42
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
39
|
-
_name_decorators = [attr()];
|
|
40
|
-
_autocomplete_decorators = [attr()];
|
|
41
|
-
_placeholder_decorators = [attr()];
|
|
42
|
-
_required_decorators = [attr()];
|
|
43
|
+
_name_decorators = [attr(), bind()];
|
|
44
|
+
_autocomplete_decorators = [attr(), bind()];
|
|
45
|
+
_placeholder_decorators = [attr(), bind()];
|
|
46
|
+
_required_decorators = [attr(), bind()];
|
|
47
|
+
_autofocus_decorators = [attr(), bind()];
|
|
43
48
|
_value_decorators = [attr({
|
|
44
49
|
reflect: false,
|
|
45
|
-
}),
|
|
46
|
-
_onReady_decorators = [ready()];
|
|
50
|
+
}), bind()];
|
|
47
51
|
_onChange_decorators = [effect()];
|
|
48
52
|
_onInputChange_decorators = [listen('input')];
|
|
49
53
|
__esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
50
54
|
__esDecorate(this, null, _autocomplete_decorators, { kind: "accessor", name: "autocomplete", static: false, private: false, access: { has: obj => "autocomplete" in obj, get: obj => obj.autocomplete, set: (obj, value) => { obj.autocomplete = value; } }, metadata: _metadata }, _autocomplete_initializers, _autocomplete_extraInitializers);
|
|
51
55
|
__esDecorate(this, null, _placeholder_decorators, { kind: "accessor", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
|
|
52
56
|
__esDecorate(this, null, _required_decorators, { kind: "accessor", name: "required", static: false, private: false, access: { has: obj => "required" in obj, get: obj => obj.required, set: (obj, value) => { obj.required = value; } }, metadata: _metadata }, _required_initializers, _required_extraInitializers);
|
|
57
|
+
__esDecorate(this, null, _autofocus_decorators, { kind: "accessor", name: "autofocus", static: false, private: false, access: { has: obj => "autofocus" in obj, get: obj => obj.autofocus, set: (obj, value) => { obj.autofocus = value; } }, metadata: _metadata }, _autofocus_initializers, _autofocus_extraInitializers);
|
|
53
58
|
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
54
|
-
__esDecorate(this, null, _onReady_decorators, { kind: "method", name: "onReady", static: false, private: false, access: { has: obj => "onReady" in obj, get: obj => obj.onReady }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
55
59
|
__esDecorate(this, null, _onChange_decorators, { kind: "method", name: "onChange", static: false, private: false, access: { has: obj => "onChange" in obj, get: obj => obj.onChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
56
60
|
__esDecorate(this, null, _onInputChange_decorators, { kind: "method", name: "onInputChange", static: false, private: false, access: { has: obj => "onInputChange" in obj, get: obj => obj.onInputChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
57
61
|
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
@@ -71,27 +75,18 @@ let USATextareaElement = (() => {
|
|
|
71
75
|
#required_accessor_storage = (__runInitializers(this, _placeholder_extraInitializers), __runInitializers(this, _required_initializers, false));
|
|
72
76
|
get required() { return this.#required_accessor_storage; }
|
|
73
77
|
set required(value) { this.#required_accessor_storage = value; }
|
|
74
|
-
#
|
|
78
|
+
#autofocus_accessor_storage = (__runInitializers(this, _required_extraInitializers), __runInitializers(this, _autofocus_initializers, false));
|
|
79
|
+
get autofocus() { return this.#autofocus_accessor_storage; }
|
|
80
|
+
set autofocus(value) { this.#autofocus_accessor_storage = value; }
|
|
81
|
+
#value_accessor_storage = (__runInitializers(this, _autofocus_extraInitializers), __runInitializers(this, _value_initializers, ''));
|
|
75
82
|
get value() { return this.#value_accessor_storage; }
|
|
76
83
|
set value(value) { this.#value_accessor_storage = value; }
|
|
77
84
|
#internals = (__runInitializers(this, _value_extraInitializers), this.attachInternals());
|
|
78
85
|
#input = query('textarea');
|
|
79
|
-
onReady() {
|
|
80
|
-
this.#input({ autofocus: this.autofocus });
|
|
81
|
-
}
|
|
82
|
-
attributeChangedCallback() {
|
|
83
|
-
this.#input({
|
|
84
|
-
name: this.name,
|
|
85
|
-
placeholder: this.placeholder,
|
|
86
|
-
autocomplete: this.autocomplete,
|
|
87
|
-
required: this.required,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
86
|
connectedCallback() {
|
|
91
87
|
this.#syncFormState();
|
|
92
88
|
}
|
|
93
89
|
onChange() {
|
|
94
|
-
this.#input({ value: this.value });
|
|
95
90
|
this.#syncFormState();
|
|
96
91
|
}
|
|
97
92
|
onInputChange() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.element.js","sourceRoot":"","sources":["../../../src/lib/textarea/textarea.element.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"textarea.element.js","sourceRoot":"","sources":["../../../src/lib/textarea/textarea.element.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './textarea.element.js';
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { assert, fixture, html } from
|
|
3
|
-
import { userEvent } from
|
|
4
|
-
describe(
|
|
5
|
-
it(
|
|
1
|
+
import './textarea.element.js';
|
|
2
|
+
import { assert, fixture, html } from '@open-wc/testing';
|
|
3
|
+
import { userEvent } from '@testing-library/user-event';
|
|
4
|
+
describe('usa-textarea', () => {
|
|
5
|
+
it('should be accessible', async () => {
|
|
6
6
|
const form = await fixture(html `<usa-textarea name="fname" value="Foo">Hello World</usa-textarea>`);
|
|
7
7
|
return assert.isAccessible(form);
|
|
8
8
|
});
|
|
9
|
-
it(
|
|
9
|
+
it('should submit form with default values', async () => {
|
|
10
10
|
const form = await fixture(html `<form><usa-textarea name="fname" value="Foo">Hello World</usa-textarea><button>Submit</button></form>`);
|
|
11
11
|
const value = new FormData(form);
|
|
12
|
-
assert.equal(value.get(
|
|
12
|
+
assert.equal(value.get('fname'), 'Foo');
|
|
13
13
|
});
|
|
14
|
-
it(
|
|
14
|
+
it('should update form value as input value changed', async () => {
|
|
15
15
|
const form = await fixture(html `<form><usa-textarea name="fname">Hello World</usa-textarea><button>Submit</button></form>`);
|
|
16
|
-
const input = form.querySelector(
|
|
17
|
-
const nativeInput = input?.shadowRoot?.querySelector(
|
|
16
|
+
const input = form.querySelector('usa-textarea');
|
|
17
|
+
const nativeInput = input?.shadowRoot?.querySelector('textarea');
|
|
18
18
|
if (nativeInput) {
|
|
19
|
-
await userEvent.type(nativeInput,
|
|
19
|
+
await userEvent.type(nativeInput, 'Bar');
|
|
20
20
|
}
|
|
21
21
|
const value = new FormData(form);
|
|
22
|
-
assert.equal(value.get(
|
|
22
|
+
assert.equal(value.get('fname'), 'Bar');
|
|
23
23
|
});
|
|
24
|
-
it(
|
|
24
|
+
it('should not submit when not valid', async () => {
|
|
25
25
|
const form = await fixture(html `<form><usa-textarea name="fname" required>Hello World</usa-textarea><button>Submit</button></form>`);
|
|
26
26
|
assert.equal(form.checkValidity(), false);
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
-
//# sourceMappingURL=textarea.test.js.map
|
|
29
|
+
//# sourceMappingURL=textarea.element.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.element.test.js","sourceRoot":"","sources":["../../../src/lib/textarea/textarea.element.test.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;KAE/C,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;;;;;KAM/C,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEjC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;;;;;KAM/C,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QACjD,MAAM,WAAW,GAAG,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QAEjE,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEjC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA;;;;;;KAM/C,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import "./breadcrumbs.element.js";
|
|
2
|
-
import "./breadcrumb/breadcrumb.element.js";
|
|
3
|
-
|
|
4
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
5
|
-
|
|
6
|
-
import type { USABreadcrumbsElement } from "./breadcrumbs.element.js";
|
|
7
|
-
|
|
8
|
-
describe("usa-breadcrumbs", () => {
|
|
9
|
-
it("should be accessible", async () => {
|
|
10
|
-
const breadcrumbs = await fixture<USABreadcrumbsElement>(html`
|
|
11
|
-
<usa-breadcrumbs>
|
|
12
|
-
<usa-breadcrumb href="/">Home</usa-breadcrumb>
|
|
13
|
-
<usa-breadcrumb href="/">Federal Contracting</usa-breadcrumb>
|
|
14
|
-
<usa-breadcrumb href="/">Contracting assistance programs</usa-breadcrumb>
|
|
15
|
-
<usa-breadcrumb>Economically disadvantaged women-owned small business federal contracting program</usa-breadcrumb>
|
|
16
|
-
</usa-breadcrumbs>
|
|
17
|
-
`);
|
|
18
|
-
|
|
19
|
-
return assert.isAccessible(breadcrumbs);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./button.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import { BUTTON_VARIANTS, type USAButtonElement } from "./button.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-button", () => {
|
|
8
|
-
for (const variant of BUTTON_VARIANTS) {
|
|
9
|
-
it("should be accessible", async () => {
|
|
10
|
-
const button = await fixture<USAButtonElement>(html`
|
|
11
|
-
<usa-button variant=${variant}>Hello World</usa-button>
|
|
12
|
-
`);
|
|
13
|
-
|
|
14
|
-
return assert.isAccessible(button);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./button-group.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USAButtonGroupElement } from "./button-group.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-button-group", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const buttonGroup = await fixture<USAButtonGroupElement>(html`
|
|
10
|
-
<usa-button-group>Hello World</usa-button-group>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(buttonGroup);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./collection-item.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USACollectionItemElement } from "./collection-item.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-collection-item", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const collectionItem = await fixture<USACollectionItemElement>(html`
|
|
10
|
-
<usa-collection-item>Hello World</usa-collection-item>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(collectionItem);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./collection.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USACollectionElement } from "./collection.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-collection", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const collection = await fixture<USACollectionElement>(html`
|
|
10
|
-
<usa-collection>Hello World</usa-collection>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(collection);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./config.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USAConfigElement } from "./config.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-config", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const config = await fixture<USAConfigElement>(html`
|
|
10
|
-
<usa-config>Hello World</usa-config>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(config);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./description.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USADescriptionElement } from "./description.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-description", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const description = await fixture<USADescriptionElement>(html`
|
|
10
|
-
<usa-description>Hello World</usa-description>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(description);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import "./file-input-preview.element.js";
|
|
2
|
-
import "../../link/link.element.js";
|
|
3
|
-
|
|
4
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
5
|
-
|
|
6
|
-
import type { USAFileInputPreviewElement } from "./file-input-preview.element.js";
|
|
7
|
-
|
|
8
|
-
describe("usa-file-input-preview", () => {
|
|
9
|
-
it("should be accessible with no files", async () => {
|
|
10
|
-
const fileInputPreview = await fixture<USAFileInputPreviewElement>(html`
|
|
11
|
-
<usa-file-input-preview>
|
|
12
|
-
Selected file <usa-link>Change file</usa-link>
|
|
13
|
-
</usa-file-input-preview>
|
|
14
|
-
`);
|
|
15
|
-
|
|
16
|
-
return assert.isAccessible(fileInputPreview);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should be accessible with files", async () => {
|
|
20
|
-
const data = new DataTransfer();
|
|
21
|
-
data.items.add(new File([], "image1.jpg"));
|
|
22
|
-
data.items.add(new File([], "image2.jpg"));
|
|
23
|
-
|
|
24
|
-
const fileInputPreview = await fixture<USAFileInputPreviewElement>(html`
|
|
25
|
-
<usa-file-input-preview .files=${data.files}>
|
|
26
|
-
Selected file <usa-link>Change file</usa-link>
|
|
27
|
-
</usa-file-input-preview>
|
|
28
|
-
`);
|
|
29
|
-
|
|
30
|
-
return assert.isAccessible(fileInputPreview);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("should display file preview for images", async () => {
|
|
34
|
-
const data = new DataTransfer();
|
|
35
|
-
data.items.add(new File([], "image1.jpg"));
|
|
36
|
-
data.items.add(new File([], "image2.jpg"));
|
|
37
|
-
|
|
38
|
-
const { shadowRoot } = await fixture<USAFileInputPreviewElement>(html`
|
|
39
|
-
<usa-file-input-preview .files=${data.files}>
|
|
40
|
-
Selected file <usa-link>Change file</usa-link>
|
|
41
|
-
</usa-file-input-preview>
|
|
42
|
-
`);
|
|
43
|
-
|
|
44
|
-
const previewItems = Array.from(
|
|
45
|
-
shadowRoot?.querySelectorAll(".preview-item") ?? [],
|
|
46
|
-
).map((item) => item.textContent?.trim());
|
|
47
|
-
|
|
48
|
-
assert.deepEqual(previewItems, ["image1.jpg", "image2.jpg"]);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it("should display fewer previews when the number of items decreases", async () => {
|
|
52
|
-
const data = new DataTransfer();
|
|
53
|
-
data.items.add(new File([], "image1.jpg"));
|
|
54
|
-
data.items.add(new File([], "image2.jpg"));
|
|
55
|
-
|
|
56
|
-
const fileInputPreview = await fixture<USAFileInputPreviewElement>(html`
|
|
57
|
-
<usa-file-input-preview .files=${data.files}>
|
|
58
|
-
Selected file <usa-link>Change file</usa-link>
|
|
59
|
-
</usa-file-input-preview>
|
|
60
|
-
`);
|
|
61
|
-
|
|
62
|
-
const data2 = new DataTransfer();
|
|
63
|
-
data2.items.add(new File([], "image1.jpg"));
|
|
64
|
-
|
|
65
|
-
fileInputPreview.files = data2.files;
|
|
66
|
-
|
|
67
|
-
// need this to wait for effects to resolve
|
|
68
|
-
await Promise.resolve();
|
|
69
|
-
|
|
70
|
-
const previewItems = Array.from(
|
|
71
|
-
fileInputPreview.shadowRoot?.querySelectorAll(".preview-item") ?? [],
|
|
72
|
-
).map((item) => item.textContent?.trim());
|
|
73
|
-
|
|
74
|
-
assert.deepEqual(previewItems, ["image1.jpg"]);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("should create preview images for each file", async () => {
|
|
78
|
-
const data = new DataTransfer();
|
|
79
|
-
data.items.add(new File(["Image1"], "image1.jpg", { type: "image/jpg" }));
|
|
80
|
-
data.items.add(new File(["Image2"], "image2.jpg", { type: "image/jpg" }));
|
|
81
|
-
|
|
82
|
-
const { shadowRoot } = await fixture<USAFileInputPreviewElement>(html`
|
|
83
|
-
<usa-file-input-preview .files=${data.files}>
|
|
84
|
-
Selected file <usa-link>Change file</usa-link>
|
|
85
|
-
</usa-file-input-preview>
|
|
86
|
-
`);
|
|
87
|
-
|
|
88
|
-
const [first, second] = Array.from(
|
|
89
|
-
shadowRoot?.querySelectorAll<HTMLImageElement>(".preview-item img") ?? [],
|
|
90
|
-
).map((item) => item.src.substring(29));
|
|
91
|
-
|
|
92
|
-
// we are just testing that the two hashes are in fact different
|
|
93
|
-
assert.isFalse(first === second);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import "./file-input.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USAFileInputElement } from "./file-input.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-file-input", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const fileInput = await fixture<USAFileInputElement>(html`
|
|
10
|
-
<usa-file-input>Hello World</usa-file-input>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(fileInput);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should submit files with the form", async () => {
|
|
17
|
-
const data = new DataTransfer();
|
|
18
|
-
data.items.add(new File([], "first.txt"));
|
|
19
|
-
data.items.add(new File([], "second.txt"));
|
|
20
|
-
|
|
21
|
-
const form = await fixture<HTMLFormElement>(html`
|
|
22
|
-
<form>
|
|
23
|
-
<usa-file-input name="upload" .files=${data.files}>
|
|
24
|
-
Input accepts a single file
|
|
25
|
-
|
|
26
|
-
<div slot="description">
|
|
27
|
-
Drag file here or <usa-link>choose from folder</usa-link>
|
|
28
|
-
</div>
|
|
29
|
-
</usa-file-input>
|
|
30
|
-
|
|
31
|
-
<button>Submit</button>
|
|
32
|
-
</form>
|
|
33
|
-
`);
|
|
34
|
-
|
|
35
|
-
const formData = new FormData(form);
|
|
36
|
-
|
|
37
|
-
const fileNames = formData.getAll("upload").map((file) => {
|
|
38
|
-
if (file instanceof File) {
|
|
39
|
-
return file.name;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return "";
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
assert.deepEqual(fileNames, ["first.txt", "second.txt"]);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("should show file preview after drag and drop", async () => {
|
|
49
|
-
const fileInput = await fixture<USAFileInputElement>(html`
|
|
50
|
-
<usa-file-input>
|
|
51
|
-
Input accepts a single file
|
|
52
|
-
</usa-file-input>
|
|
53
|
-
`);
|
|
54
|
-
|
|
55
|
-
const nativeInput = fileInput.shadowRoot?.querySelector("input");
|
|
56
|
-
|
|
57
|
-
assert.isOk(nativeInput);
|
|
58
|
-
|
|
59
|
-
// Simulate drag and drop with a file
|
|
60
|
-
const data = new DataTransfer();
|
|
61
|
-
data.items.add(new File([], "test.txt"));
|
|
62
|
-
|
|
63
|
-
const dropEvent = new DragEvent("drop", {
|
|
64
|
-
dataTransfer: data,
|
|
65
|
-
bubbles: true,
|
|
66
|
-
cancelable: true,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
nativeInput.dispatchEvent(dropEvent);
|
|
70
|
-
|
|
71
|
-
// Wait for effects to resolve
|
|
72
|
-
await Promise.resolve();
|
|
73
|
-
|
|
74
|
-
// Verify that filesVisible is true and files are set
|
|
75
|
-
assert.isTrue(fileInput.filesVisible);
|
|
76
|
-
assert.equal(fileInput.files?.length, 1);
|
|
77
|
-
assert.equal(fileInput.files?.[0].name, "test.txt");
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./modal-close.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USAModalCloseElement } from "./modal-close.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-modal-close", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const modalClose = await fixture<USAModalCloseElement>(html`
|
|
10
|
-
<usa-modal-close>Hello World</usa-modal-close>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(modalClose);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./modal-heading.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USAModalHeadingElement } from "./modal-heading.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-modal-heading", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const modalHeading = await fixture<USAModalHeadingElement>(html`
|
|
10
|
-
<usa-modal-heading>Hello World</usa-modal-heading>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(modalHeading);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import "./modal.element.js";
|
|
2
|
-
import "./modal-heading/modal-heading.element.js";
|
|
3
|
-
import "./modal-close/modal-close.element.js";
|
|
4
|
-
|
|
5
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
6
|
-
|
|
7
|
-
import type { USAModalElement } from "./modal.element.js";
|
|
8
|
-
|
|
9
|
-
describe("usa-modal", () => {
|
|
10
|
-
it("should be accessible", async () => {
|
|
11
|
-
const modal = await fixture<USAModalElement>(html`
|
|
12
|
-
<usa-modal open>
|
|
13
|
-
<usa-modal-close></usa-modal-close>
|
|
14
|
-
|
|
15
|
-
<usa-modal-heading>
|
|
16
|
-
Are you sure you want to continue?
|
|
17
|
-
</usa-modal-heading>
|
|
18
|
-
|
|
19
|
-
<p>This is some other example of content</p>
|
|
20
|
-
</usa-modal>
|
|
21
|
-
`);
|
|
22
|
-
|
|
23
|
-
return assert.isAccessible(modal);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./pagination.element.js";
|
|
2
|
-
|
|
3
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
4
|
-
|
|
5
|
-
import type { USAPaginationElement } from "./pagination.element.js";
|
|
6
|
-
|
|
7
|
-
describe("usa-pagination", () => {
|
|
8
|
-
it("should be accessible", async () => {
|
|
9
|
-
const pagination = await fixture<USAPaginationElement>(html`
|
|
10
|
-
<usa-pagination>Hello World</usa-pagination>
|
|
11
|
-
`);
|
|
12
|
-
|
|
13
|
-
return assert.isAccessible(pagination);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import "../radio.element.js";
|
|
2
|
-
import "./radio-option.element.js";
|
|
3
|
-
|
|
4
|
-
import { assert, fixture, html } from "@open-wc/testing";
|
|
5
|
-
|
|
6
|
-
import type { USARadioOptionElement } from "./radio-option.element.js";
|
|
7
|
-
|
|
8
|
-
describe("usa-radio-option", () => {
|
|
9
|
-
it("should map value to slot", async () => {
|
|
10
|
-
const radio = await fixture<USARadioOptionElement>(html`
|
|
11
|
-
<usa-radio>
|
|
12
|
-
<usa-radio-option value="first">First</usa-radio-option>
|
|
13
|
-
</usa-radio>
|
|
14
|
-
`);
|
|
15
|
-
|
|
16
|
-
const option = radio.querySelectorAll("usa-radio-option");
|
|
17
|
-
|
|
18
|
-
assert.equal(option[0].value, option[0].slot);
|
|
19
|
-
});
|
|
20
|
-
});
|