@triptease/tt-date-picker 6.0.17 → 6.0.19
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/dist/src/TtDatePicker.js +6 -1
- package/dist/src/TtDatePicker.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/types.d.ts +25 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +15 -6
- package/.editorconfig +0 -29
- package/CHANGELOG.md +0 -73
- package/demo/index.html +0 -26
- package/dist/test/date-picker.test.d.ts +0 -1
- package/dist/test/date-picker.test.js +0 -57
- package/dist/test/date-picker.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/web/FocusEvent.d.js +0 -4
- package/dist/web/FocusEvent.d.js.map +0 -7
- package/dist/web/TtDatePicker.js +0 -7619
- package/dist/web/TtDatePicker.js.map +0 -7
- package/dist/web/helpers.js +0 -6475
- package/dist/web/helpers.js.map +0 -7
- package/dist/web/index.js +0 -9008
- package/dist/web/index.js.map +0 -7
- package/dist/web/styles.js +0 -659
- package/dist/web/styles.js.map +0 -7
- package/dist/web/tt-date-picker.js +0 -9008
- package/dist/web/tt-date-picker.js.map +0 -7
- package/src/FocusEvent.d.ts +0 -13
- package/src/TtDatePicker.ts +0 -249
- package/src/helpers.ts +0 -7
- package/src/index.ts +0 -1
- package/src/styles.ts +0 -67
- package/src/tt-date-picker.ts +0 -23
- package/test/date-picker.test.ts +0 -78
- package/tsconfig.json +0 -22
- package/web-dev-server.config.js +0 -27
- package/web-test-runner.config.js +0 -41
package/src/FocusEvent.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
interface FocusEvent {
|
|
5
|
-
/**
|
|
6
|
-
* Adds the non-standard `explicitOriginalTarget` property to the `FocusEvent` interface. Firefox seems to populate this,
|
|
7
|
-
* but not relatedTarget in certain browsers
|
|
8
|
-
*
|
|
9
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/Event/explicitOriginalTarget
|
|
10
|
-
*/
|
|
11
|
-
explicitOriginalTarget?: EventTarget | null;
|
|
12
|
-
}
|
|
13
|
-
}
|
package/src/TtDatePicker.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { css, html, LitElement, nothing, PropertyValues } from 'lit';
|
|
2
|
-
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
-
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
4
|
-
import { DateTime } from 'luxon';
|
|
5
|
-
import { Calendar } from '@triptease/tt-calendar';
|
|
6
|
-
import { calendarIcon } from '@triptease/icons';
|
|
7
|
-
import { TtDialog } from '@triptease/tt-dialog';
|
|
8
|
-
import { DateInput } from '@triptease/tt-date-input';
|
|
9
|
-
import { DateSelectionEvent } from '@triptease/tt-calendar/date-selection-context.js';
|
|
10
|
-
import { dateConverter } from './helpers.js';
|
|
11
|
-
import { styles } from './styles.js';
|
|
12
|
-
|
|
13
|
-
export class TtDatePicker extends LitElement {
|
|
14
|
-
static styles = [
|
|
15
|
-
styles,
|
|
16
|
-
css`
|
|
17
|
-
[part='controls'] {
|
|
18
|
-
min-width: 19.1ch;
|
|
19
|
-
}
|
|
20
|
-
`,
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
static formAssociated = true;
|
|
24
|
-
|
|
25
|
-
static shadowRootOptions = {
|
|
26
|
-
...LitElement.shadowRootOptions,
|
|
27
|
-
delegatesFocus: true,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
@query('tt-calendar')
|
|
31
|
-
calendar!: Calendar;
|
|
32
|
-
|
|
33
|
-
@query('tt-dialog')
|
|
34
|
-
dialog!: TtDialog;
|
|
35
|
-
|
|
36
|
-
@property({ type: String })
|
|
37
|
-
public value?: string;
|
|
38
|
-
|
|
39
|
-
@property({
|
|
40
|
-
type: Date,
|
|
41
|
-
converter: dateConverter,
|
|
42
|
-
})
|
|
43
|
-
public minDate?: Date;
|
|
44
|
-
|
|
45
|
-
@property({
|
|
46
|
-
type: Date,
|
|
47
|
-
converter: dateConverter,
|
|
48
|
-
})
|
|
49
|
-
public maxDate?: Date;
|
|
50
|
-
|
|
51
|
-
@property({ type: Boolean, attribute: 'open-left' })
|
|
52
|
-
public openLeft = false;
|
|
53
|
-
|
|
54
|
-
@property({ type: Boolean })
|
|
55
|
-
public disabled = false;
|
|
56
|
-
|
|
57
|
-
// Internal DateTime properties for calculations
|
|
58
|
-
private get _valueDateTime(): DateTime | undefined {
|
|
59
|
-
return this.value ? DateTime.fromISO(this.value) : undefined;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private get _minDateTime(): DateTime | undefined {
|
|
63
|
-
return this.minDate ? DateTime.fromJSDate(this.minDate) : undefined;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private get _maxDateTime(): DateTime | undefined {
|
|
67
|
-
return this.maxDate ? DateTime.fromJSDate(this.maxDate) : undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@state()
|
|
71
|
-
private _open: boolean = false;
|
|
72
|
-
|
|
73
|
-
@query('tt-date-input')
|
|
74
|
-
private dateInput!: DateInput;
|
|
75
|
-
|
|
76
|
-
public internals: ReturnType<typeof this.attachInternals>;
|
|
77
|
-
|
|
78
|
-
private get _formValue(): string {
|
|
79
|
-
return this.value ?? '';
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
constructor() {
|
|
83
|
-
super();
|
|
84
|
-
this.internals = this.attachInternals();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
onDateChange(e: Event) {
|
|
88
|
-
if (DateSelectionEvent.is(e)) {
|
|
89
|
-
this.value = e.detail;
|
|
90
|
-
} else if (e.type === 'change') {
|
|
91
|
-
this.value = (e.target as HTMLInputElement).value;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this.dispatchEvent(new InputEvent('change'));
|
|
95
|
-
this.dialog.hide();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
get form(): HTMLFormElement | null {
|
|
99
|
-
return this.internals.form;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public updated(changedProperties: PropertyValues) {
|
|
103
|
-
super.updated(changedProperties);
|
|
104
|
-
|
|
105
|
-
if (changedProperties.has('value')) {
|
|
106
|
-
this.internals.setFormValue(this._formValue);
|
|
107
|
-
this.validate();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (changedProperties.has('disabled')) {
|
|
111
|
-
if (this.disabled) {
|
|
112
|
-
this.internals.setFormValue(null);
|
|
113
|
-
this.internals.states.add('disabled');
|
|
114
|
-
this.inert = true;
|
|
115
|
-
} else {
|
|
116
|
-
this.internals.states.delete('disabled');
|
|
117
|
-
this.internals.setFormValue(this._formValue);
|
|
118
|
-
this.inert = false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
private validate() {
|
|
124
|
-
const wasValid = this.internals.validity.valid;
|
|
125
|
-
const oldMessage = this.internals.validationMessage;
|
|
126
|
-
this.internals.setValidity({});
|
|
127
|
-
|
|
128
|
-
if (this._valueDateTime) {
|
|
129
|
-
const minDateIsValid =
|
|
130
|
-
!this._minDateTime || this._valueDateTime > this._minDateTime || this._valueDateTime.equals(this._minDateTime);
|
|
131
|
-
if (!minDateIsValid) {
|
|
132
|
-
this.internals.setValidity(
|
|
133
|
-
{ rangeUnderflow: true },
|
|
134
|
-
`Date should be equal or after ${this._minDateTime?.toLocaleString({
|
|
135
|
-
month: 'short',
|
|
136
|
-
day: 'numeric',
|
|
137
|
-
year: 'numeric',
|
|
138
|
-
})}`
|
|
139
|
-
);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const maxDateIsValid =
|
|
143
|
-
!this._maxDateTime || this._valueDateTime.equals(this._maxDateTime) || this._valueDateTime < this._maxDateTime;
|
|
144
|
-
if (!maxDateIsValid) {
|
|
145
|
-
this.internals.setValidity(
|
|
146
|
-
{ rangeOverflow: true },
|
|
147
|
-
`Date should be before or equal to ${this._maxDateTime?.toLocaleString({
|
|
148
|
-
month: 'short',
|
|
149
|
-
day: 'numeric',
|
|
150
|
-
year: 'numeric',
|
|
151
|
-
})}`
|
|
152
|
-
);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
if (wasValid !== this.internals.validity.valid || oldMessage !== this.internals.validationMessage) {
|
|
157
|
-
this.requestUpdate();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
public connectedCallback() {
|
|
162
|
-
super.connectedCallback();
|
|
163
|
-
|
|
164
|
-
this.addEventListener('date-selection', this.onDateChange);
|
|
165
|
-
this.addEventListener('dialog-open', this._onDialogOpen);
|
|
166
|
-
this.addEventListener('dialog-close', this._onDialogClose);
|
|
167
|
-
this.addEventListener('focusout', this.onFocusOut);
|
|
168
|
-
this.addEventListener('focus', this._onFocus);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
private _onDialogOpen = () => {
|
|
172
|
-
this._open = true;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
private _onDialogClose = () => {
|
|
176
|
-
this._open = false;
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
public onFocusOut = (event: FocusEvent) => {
|
|
180
|
-
if (!this._open) return;
|
|
181
|
-
|
|
182
|
-
const target = (event.relatedTarget ?? event.explicitOriginalTarget) as HTMLElement | null;
|
|
183
|
-
|
|
184
|
-
if (!this.contains(target)) {
|
|
185
|
-
this.dialog.hide();
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
private _onFocus = () => {
|
|
190
|
-
this.dateInput.focus();
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
public disconnectedCallback() {
|
|
194
|
-
super.disconnectedCallback();
|
|
195
|
-
this.removeEventListener('date-selection', this.onDateChange);
|
|
196
|
-
this.removeEventListener('dialog-open', this._onDialogOpen);
|
|
197
|
-
this.removeEventListener('dialog-close', this._onDialogClose);
|
|
198
|
-
this.removeEventListener('focusout', this.onFocusOut);
|
|
199
|
-
this.removeEventListener('focus', this._onFocus);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
showCalendar() {
|
|
203
|
-
if (!this._open) {
|
|
204
|
-
this.dialog.show();
|
|
205
|
-
|
|
206
|
-
if (this.openLeft) {
|
|
207
|
-
this.style.setProperty('--calendar-left-distance', '-192px');
|
|
208
|
-
}
|
|
209
|
-
} else {
|
|
210
|
-
this.dialog.hide();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
render() {
|
|
215
|
-
return html`
|
|
216
|
-
<div part="controls" aria-invalid=${!this.internals.validity.valid} aria-disabled="${this.disabled}">
|
|
217
|
-
<div name="container" part="container">
|
|
218
|
-
<tt-date-input @change=${this.onDateChange} .value=${this.value} .disabled=${this.disabled}></tt-date-input>
|
|
219
|
-
</div>
|
|
220
|
-
<button
|
|
221
|
-
name="Show calendar"
|
|
222
|
-
@click=${this.showCalendar}
|
|
223
|
-
class="show-calendar"
|
|
224
|
-
aria-label="Choose date, ${this}"
|
|
225
|
-
?disabled=${this.disabled}
|
|
226
|
-
>
|
|
227
|
-
${unsafeSVG(calendarIcon)}
|
|
228
|
-
</button>
|
|
229
|
-
</div>
|
|
230
|
-
<tt-dialog name="calendar" aria-label="Choose date" part="dialog">
|
|
231
|
-
<tt-calendar
|
|
232
|
-
.value="${this.value}"
|
|
233
|
-
.minDate=${this.minDate}
|
|
234
|
-
.maxDate=${this.maxDate}
|
|
235
|
-
part="calendar"
|
|
236
|
-
></tt-calendar>
|
|
237
|
-
</tt-dialog>
|
|
238
|
-
<div class="errormessage" id="error-msg-${this.id}" role="alert" aria-atomic="true" part="error">
|
|
239
|
-
${this.internals.validity.valid ? nothing : this.internals.validationMessage}
|
|
240
|
-
</div>
|
|
241
|
-
`;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
declare global {
|
|
246
|
-
interface HTMLElementTagNameMap {
|
|
247
|
-
'tt-date-picker': TtDatePicker;
|
|
248
|
-
}
|
|
249
|
-
}
|
package/src/helpers.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DateTime } from 'luxon';
|
|
2
|
-
|
|
3
|
-
export const dateConverter = (value: string | null): Date | undefined =>
|
|
4
|
-
value ? DateTime.fromISO(value).toJSDate() : undefined;
|
|
5
|
-
|
|
6
|
-
export const dateTimeConverter = (value: string | null): DateTime | undefined =>
|
|
7
|
-
value ? DateTime.fromISO(value) : undefined;
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { TtDatePicker } from './tt-date-picker.js';
|
package/src/styles.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
|
|
3
|
-
export const styles = css`
|
|
4
|
-
:host {
|
|
5
|
-
position: relative;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
:host(:state(disabled)) {
|
|
9
|
-
pointer-events: none;
|
|
10
|
-
opacity: 0.5;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
tt-side-panel::part(side-panel) {
|
|
14
|
-
border-right: 1px solid var(--color-border-200);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
tt-side-panel:empty {
|
|
18
|
-
display: none;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
[part='container'] {
|
|
22
|
-
padding: var(--space-scale-1) var(--space-scale-1-5);
|
|
23
|
-
gap: var(--space-scale-1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
[part='controls'] {
|
|
27
|
-
display: flex;
|
|
28
|
-
border: 1px solid var(--color-border-200);
|
|
29
|
-
border-radius: var(--border-radius);
|
|
30
|
-
width: fit-content;
|
|
31
|
-
height: var(--date-picker-height, fit-content);
|
|
32
|
-
background-color: var(--color-surface-100);
|
|
33
|
-
font-size: var(--font-size-200);
|
|
34
|
-
color: var(--color-text-400);
|
|
35
|
-
align-items: stretch;
|
|
36
|
-
justify-content: space-around;
|
|
37
|
-
padding: 0;
|
|
38
|
-
|
|
39
|
-
&[aria-invalid='true'] {
|
|
40
|
-
outline: 2px solid var(--color-alert-300, red);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
button {
|
|
44
|
-
border: 0;
|
|
45
|
-
padding-inline: var(--space-scale-1);
|
|
46
|
-
background-color: transparent;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
justify-content: center;
|
|
51
|
-
align-self: stretch;
|
|
52
|
-
border-left: 1px solid var(--color-border-200);
|
|
53
|
-
box-sizing: border-box;
|
|
54
|
-
color: var(--color-text-400);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&:has(+ tt-dialog[open]) .show-calendar svg,
|
|
58
|
-
.show-calendar:hover svg {
|
|
59
|
-
color: var(--color-primary-400);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
[part='dialog']::part(dialog) {
|
|
64
|
-
margin-top: var(--space-scale-1);
|
|
65
|
-
flex-direction: row-reverse;
|
|
66
|
-
}
|
|
67
|
-
`;
|
package/src/tt-date-picker.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Calendar } from '@triptease/tt-calendar/tt-calendar.js';
|
|
2
|
-
import { DateInput } from '@triptease/tt-date-input/tt-date-input.js';
|
|
3
|
-
import { TtDialog } from '@triptease/tt-dialog/tt-dialog.js';
|
|
4
|
-
import { TtDatePicker } from './TtDatePicker.js';
|
|
5
|
-
|
|
6
|
-
if (typeof window !== 'undefined') {
|
|
7
|
-
if (!window.customElements.get('tt-calendar')) {
|
|
8
|
-
window.customElements.define('tt-calendar', Calendar);
|
|
9
|
-
}
|
|
10
|
-
if (!window.customElements.get('tt-date-input')) {
|
|
11
|
-
window.customElements.define('tt-date-input', DateInput);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (!window.customElements.get('tt-dialog')) {
|
|
15
|
-
window.customElements.define('tt-dialog', TtDialog);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!window.customElements.get('tt-date-picker')) {
|
|
19
|
-
window.customElements.define('tt-date-picker', TtDatePicker);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { TtDatePicker };
|
package/test/date-picker.test.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { elementUpdated, expect, fixture, oneDefaultPreventedEvent, oneEvent } from '@open-wc/testing';
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
import { Settings } from 'luxon';
|
|
4
|
-
import { TtDialog } from '@triptease/tt-dialog';
|
|
5
|
-
import '../src/index.js'; // This handles the registration
|
|
6
|
-
import { TtDatePicker } from '../src/index.js';
|
|
7
|
-
|
|
8
|
-
describe('TtDatePicker', () => {
|
|
9
|
-
afterEach(() => {
|
|
10
|
-
Settings.defaultZone = 'system';
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
['Australia/Brisbane', 'America/New_York', 'Europe/London', 'Asia/Tokyo', 'Etc/UTC'].forEach((timezone) => {
|
|
14
|
-
it('should include date value in form submission data', async () => {
|
|
15
|
-
Settings.defaultZone = timezone;
|
|
16
|
-
const form = await fixture<HTMLFormElement>(html`
|
|
17
|
-
<form method="post" action="#">
|
|
18
|
-
<input type="text" name="other_field" value="test_value" />
|
|
19
|
-
<tt-date-picker name="booking_date" value="2025-04-16"></tt-date-picker>
|
|
20
|
-
<button type="submit">Submit</button>
|
|
21
|
-
</form>
|
|
22
|
-
`);
|
|
23
|
-
|
|
24
|
-
const datePicker = form.querySelector('tt-date-picker') as TtDatePicker;
|
|
25
|
-
expect(datePicker).to.exist;
|
|
26
|
-
|
|
27
|
-
await elementUpdated(datePicker);
|
|
28
|
-
|
|
29
|
-
setTimeout(() => form.querySelector('button')!.click());
|
|
30
|
-
await oneDefaultPreventedEvent(form, 'submit');
|
|
31
|
-
|
|
32
|
-
const formData = new FormData(form);
|
|
33
|
-
const dateValue = formData.get('booking_date');
|
|
34
|
-
const expectedDate = `2025-04-16`;
|
|
35
|
-
|
|
36
|
-
expect(dateValue).to.equal(expectedDate);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it(`should emit change event on date selection for ${timezone}`, async () => {
|
|
40
|
-
Settings.defaultZone = timezone;
|
|
41
|
-
const datePicker = await fixture<TtDatePicker>(html` <tt-date-picker value="2025-05-01"></tt-date-picker> `);
|
|
42
|
-
|
|
43
|
-
const showCalendarButton = datePicker.shadowRoot!.querySelector('[name="Show calendar"]') as HTMLButtonElement;
|
|
44
|
-
showCalendarButton.click();
|
|
45
|
-
await elementUpdated(datePicker);
|
|
46
|
-
|
|
47
|
-
const changeEventPromise = oneEvent(datePicker, 'change');
|
|
48
|
-
|
|
49
|
-
const calendar = datePicker.shadowRoot!.querySelector('tt-calendar')!;
|
|
50
|
-
const desiredDate = calendar.shadowRoot!.querySelector(
|
|
51
|
-
'[role="gridcell"][data-date="2025-05-02"]'
|
|
52
|
-
) as HTMLLIElement;
|
|
53
|
-
desiredDate.click();
|
|
54
|
-
await elementUpdated(datePicker);
|
|
55
|
-
|
|
56
|
-
const event = await changeEventPromise;
|
|
57
|
-
const eventValue = (event.target as TtDatePicker).value;
|
|
58
|
-
|
|
59
|
-
const expectedEndDate = '2025-05-02';
|
|
60
|
-
|
|
61
|
-
expect(eventValue).to.equal(expectedEndDate);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should disable the date picker when disabled attribute is set', async () => {
|
|
66
|
-
const datePicker = await fixture<TtDatePicker>(html`
|
|
67
|
-
<tt-date-picker value="2025-05-01" disabled></tt-date-picker>
|
|
68
|
-
`);
|
|
69
|
-
|
|
70
|
-
expect(datePicker.inert).to.be.true;
|
|
71
|
-
|
|
72
|
-
const showCalendarButton = datePicker.shadowRoot!.querySelector('button.show-calendar') as HTMLButtonElement;
|
|
73
|
-
showCalendarButton.click();
|
|
74
|
-
|
|
75
|
-
const dialog = datePicker.shadowRoot!.querySelector('tt-dialog') as TtDialog;
|
|
76
|
-
expect(dialog.open).to.be.false;
|
|
77
|
-
});
|
|
78
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2021",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": ["es2021", "dom", "DOM.Iterable"],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
|
-
"importHelpers": true,
|
|
13
|
-
"outDir": "dist",
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"inlineSources": true,
|
|
16
|
-
"rootDir": ".",
|
|
17
|
-
"declaration": true,
|
|
18
|
-
"incremental": true,
|
|
19
|
-
"skipLibCheck": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/**/*.ts", "stories/**/*.ts", "test/**/*.ts"]
|
|
22
|
-
}
|
package/web-dev-server.config.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
-
|
|
3
|
-
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
-
const hmr = process.argv.includes('--hmr');
|
|
5
|
-
|
|
6
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
-
open: '/demo/',
|
|
8
|
-
/** Use regular watch mode if HMR is not enabled. */
|
|
9
|
-
watch: !hmr,
|
|
10
|
-
/** Resolve bare module imports */
|
|
11
|
-
nodeResolve: {
|
|
12
|
-
exportConditions: ['browser', 'development'],
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
16
|
-
// esbuildTarget: 'auto'
|
|
17
|
-
|
|
18
|
-
/** Set appIndex to enable SPA routing */
|
|
19
|
-
// appIndex: 'demo/index.html',
|
|
20
|
-
|
|
21
|
-
plugins: [
|
|
22
|
-
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
23
|
-
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.lit] }),
|
|
24
|
-
],
|
|
25
|
-
|
|
26
|
-
// See documentation for all available options
|
|
27
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
2
|
-
|
|
3
|
-
const filteredLogs = ['Running in dev mode', 'Lit is in dev mode'];
|
|
4
|
-
|
|
5
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
6
|
-
/** Test files to run */
|
|
7
|
-
files: 'dist/test/**/*.test.js',
|
|
8
|
-
|
|
9
|
-
/** Resolve bare module imports */
|
|
10
|
-
nodeResolve: {
|
|
11
|
-
exportConditions: ['browser', 'development'],
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/** Filter out lit dev mode logs */
|
|
15
|
-
filterBrowserLogs(log) {
|
|
16
|
-
for (const arg of log.args) {
|
|
17
|
-
if (typeof arg === 'string' && filteredLogs.some((l) => arg.includes(l))) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
25
|
-
// esbuildTarget: 'auto',
|
|
26
|
-
|
|
27
|
-
/** Amount of browsers to run concurrently */
|
|
28
|
-
// concurrentBrowsers: 2,
|
|
29
|
-
|
|
30
|
-
/** Amount of test files per browser to test concurrently */
|
|
31
|
-
// concurrency: 1,
|
|
32
|
-
|
|
33
|
-
/** Browsers to run tests on */
|
|
34
|
-
// browsers: [
|
|
35
|
-
// playwrightLauncher({ product: 'chromium' }),
|
|
36
|
-
// playwrightLauncher({ product: 'firefox' }),
|
|
37
|
-
// playwrightLauncher({ product: 'webkit' }),
|
|
38
|
-
// ],
|
|
39
|
-
|
|
40
|
-
// See documentation for all available options
|
|
41
|
-
});
|