lightning-base-components 1.16.3-alpha → 1.16.5-alpha
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/README.md +7 -0
- package/metadata/raptor.json +110 -0
- package/package.json +59 -2
- package/scopedImports/@salesforce-label-LightningForm.cancel.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.closeError.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.edit.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.editErrorHelp.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.error.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.errorPopoverHeading.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.preview.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.previewHeader.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.reload.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.save.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.saveFieldErrorSummary.js +1 -0
- package/scopedImports/@salesforce-label-LightningForm.undo.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.messageWhenMissingInformation.js +1 -0
- package/src/lightning/button/__docs__/button.md +13 -0
- package/src/lightning/button/button.slds.css +155 -11
- package/src/lightning/buttonGroup/button-group.slds.css +35 -59
- package/src/lightning/buttonIcon/button-icon.slds.css +287 -122
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +224 -39
- package/src/lightning/buttonStateful/button-stateful.slds.css +3269 -0
- package/src/lightning/card/card.slds.css +50 -0
- package/src/lightning/colorPickerCustom/color-picker-custom.slds.css +180 -364
- package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +46 -413
- package/src/lightning/datatable/datatable.js +2 -2
- package/src/lightning/datatable/rowSelection.js +21 -4
- package/src/lightning/datetimepicker/datetimepicker.html +1 -3
- package/src/lightning/datetimepicker/datetimepicker.js +5 -0
- package/src/lightning/fileDownload/__docs__/fileDownload.md +41 -0
- package/src/lightning/helptext/help-text.slds.css +184 -39
- package/src/lightning/icon/icon.slds.css +823 -3
- package/src/lightning/input/input-checkbox.slds.css +291 -32
- package/src/lightning/input/input-text.slds.css +70 -7
- package/src/lightning/inputAddress/__docs__/inputAddress.md +1 -1
- package/src/lightning/inputAddress/inputAddress.js +2 -1
- package/src/lightning/internationalizationLibrary/datetime/intlFormat.js +20 -2
- package/src/lightning/iso8601Utils/iso8601Utils.js +2 -3
- package/src/lightning/mediaUtils/__docs__/mediaUtils.md +87 -0
- package/src/lightning/mediaUtils/mediaUtils.js +321 -0
- package/src/lightning/mediaUtils/mediaUtils.js-meta.xml +6 -0
- package/src/lightning/modal/__docs__/migration.md +158 -0
- package/src/lightning/modal/__docs__/modal.md +414 -0
- package/src/lightning/modal/__examples__disabled/all/all.css +7 -0
- package/src/lightning/modal/__examples__disabled/all/all.html +9 -0
- package/src/lightning/modal/__examples__disabled/all/all.js +25 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.css +7 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.html +9 -0
- package/src/lightning/modal/__examples__disabled/allform/allform.js +49 -0
- package/src/lightning/modal/__examples__disabled/allmulti/allmulti.html +24 -0
- package/src/lightning/modal/__examples__disabled/allmulti/allmulti.js +12 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.css +7 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.html +9 -0
- package/src/lightning/modal/__examples__disabled/basic/basic.js +27 -0
- package/src/lightning/modal/__examples__disabled/demo/demo.html +15 -0
- package/src/lightning/modal/__examples__disabled/demo/demo.js +13 -0
- package/src/lightning/modal/__examples__disabled/demoall/demoall.html +26 -0
- package/src/lightning/modal/__examples__disabled/demoall/demoall.js +13 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.css +3 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.html +146 -0
- package/src/lightning/modal/__examples__disabled/demoallform/demoallform.js +240 -0
- package/src/lightning/modal/__examples__disabled/demofootless/demofootless.html +17 -0
- package/src/lightning/modal/__examples__disabled/demofootless/demofootless.js +11 -0
- package/src/lightning/modal/__examples__disabled/demoheadless/demoheadless.html +20 -0
- package/src/lightning/modal/__examples__disabled/demoheadless/demoheadless.js +12 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.css +7 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.html +9 -0
- package/src/lightning/modal/__examples__disabled/footless/footless.js +19 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.css +7 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.html +9 -0
- package/src/lightning/modal/__examples__disabled/headless/headless.js +27 -0
- package/src/lightning/modal/modal.html +3 -0
- package/src/lightning/modal/modal.js +93 -0
- package/src/lightning/modal/modal.js-meta.xml +6 -0
- package/src/lightning/modalBody/__docs__/modalBody.md +61 -0
- package/src/lightning/modalBody/modalBody.html +13 -0
- package/src/lightning/modalBody/modalBody.js +203 -0
- package/src/lightning/modalBody/modalBody.js-meta.xml +6 -0
- package/src/lightning/modalFooter/__docs__/modalFooter.md +72 -0
- package/src/lightning/modalFooter/modalFooter.html +8 -0
- package/src/lightning/modalFooter/modalFooter.js +161 -0
- package/src/lightning/modalFooter/modalFooter.js-meta.xml +6 -0
- package/src/lightning/modalHeader/__docs__/modalHeader.md +64 -0
- package/src/lightning/modalHeader/modalHeader.html +16 -0
- package/src/lightning/modalHeader/modalHeader.js +204 -0
- package/src/lightning/modalHeader/modalHeader.js-meta.xml +6 -0
- package/src/lightning/primitiveBubble/tooltip.slds.css +45 -1
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -12
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +2994 -319
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +14 -11
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +1 -0
- package/src/lightning/primitiveIcon/icon.slds.css +823 -3
- package/src/lightning/progressStep/base.html +1 -0
- package/src/lightning/progressStep/path.html +1 -1
- package/src/lightning/radioGroup/input-radio-group.slds.css +168 -379
- package/src/lightning/spinner/spinner.slds.css +8 -2
- package/src/lightning/timepicker/timepicker.html +1 -4
- package/src/lightning/timepicker/timepicker.js +9 -5
- package/src/lightning/treeGrid/treeGrid.js +66 -1
- package/src/lightning/utilsPrivate/linkUtils.js +1 -1
- package/src/lightning/formattedAddress/__component__/formattedAddress.spec.js +0 -61
- package/src/lightning/formattedAddress/__component__/formattedAddressDisabled.spec.js +0 -20
- package/src/lightning/formattedAddress/__component__/x/basic/basic.html +0 -10
- package/src/lightning/formattedAddress/__component__/x/basic/basic.js +0 -17
- package/src/lightning/input/__component__/inputCheckbox.spec.js +0 -60
- package/src/lightning/input/__component__/inputDateTimePicker.spec.js +0 -60
- package/src/lightning/input/__component__/inputNumber.spec.js +0 -75
- package/src/lightning/input/__component__/inputSelection.spec.js +0 -83
- package/src/lightning/input/__component__/x/tall/tall.css +0 -5
- package/src/lightning/input/__component__/x/tall/tall.html +0 -5
- package/src/lightning/input/__component__/x/tall/tall.js +0 -7
|
@@ -33,13 +33,19 @@
|
|
|
33
33
|
/* brand */
|
|
34
34
|
|
|
35
35
|
:host([data-render-mode="shadow"][variant='brand']) [part~='spinner'] {
|
|
36
|
-
--slds-c-spinner-color-background: var(
|
|
36
|
+
--slds-c-spinner-color-background: var(
|
|
37
|
+
--slds-c-spinner-brand-color-background,
|
|
38
|
+
var(--sds-g-color-brand-base-60, #1b96ff)
|
|
39
|
+
);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
/* inverse */
|
|
40
43
|
|
|
41
44
|
:host([data-render-mode="shadow"][variant='inverse']) [part~='spinner'] {
|
|
42
|
-
--slds-c-spinner-color-background: var(
|
|
45
|
+
--slds-c-spinner-color-background: var(
|
|
46
|
+
--slds-c-spinner-inverse-color-background,
|
|
47
|
+
var(--sds-g-color-neutral-base-100, #ffffff)
|
|
48
|
+
);
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
/* large */
|
|
@@ -36,8 +36,5 @@
|
|
|
36
36
|
>
|
|
37
37
|
</lightning-base-combobox>
|
|
38
38
|
</div>
|
|
39
|
-
|
|
40
|
-
<template if:true={_errorMessage}>
|
|
41
|
-
<div id="error-message" data-error-message class="slds-form-element__help" aria-live="assertive">{_errorMessage}</div>
|
|
42
|
-
</template>
|
|
39
|
+
<div id="error-message" data-error-message class={computedClass} aria-live="assertive">{_errorMessage}</div>
|
|
43
40
|
</template>
|
|
@@ -285,11 +285,10 @@ export default class LightningTimePicker extends LightningElement {
|
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (errorMessage) {
|
|
288
|
+
if (this._errorMessage) {
|
|
289
|
+
const errorMessage = this.template.querySelector(
|
|
290
|
+
'[data-error-message]'
|
|
291
|
+
);
|
|
293
292
|
describedByElements.push(errorMessage);
|
|
294
293
|
}
|
|
295
294
|
|
|
@@ -319,6 +318,11 @@ export default class LightningTimePicker extends LightningElement {
|
|
|
319
318
|
return this.variant === VARIANT.LABEL_HIDDEN;
|
|
320
319
|
}
|
|
321
320
|
|
|
321
|
+
get computedClass() {
|
|
322
|
+
let displayClass = this._errorMessage ? 'slds-show' : 'slds-hide';
|
|
323
|
+
return 'slds-form-element__help ' + displayClass;
|
|
324
|
+
}
|
|
325
|
+
|
|
322
326
|
get computedLabelClass() {
|
|
323
327
|
return classSet('slds-form-element__label')
|
|
324
328
|
.add({ 'slds-assistive-text': this.isLabelHidden })
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { LightningElement, api, track } from 'lwc';
|
|
2
2
|
import { normalizeColumns, normalizeData } from './normalizer';
|
|
3
3
|
import { arraysEqual } from 'lightning/utilsPrivate';
|
|
4
|
+
const ROWS_ACTION = {
|
|
5
|
+
SELECT_ALL_ROWS: 'selectAllRows',
|
|
6
|
+
DESELECT_ALL_ROWS: 'deselectAllRows',
|
|
7
|
+
ROW_SELECT: 'rowSelect',
|
|
8
|
+
ROW_DESELECT: 'rowDeselect',
|
|
9
|
+
};
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* Displays a hierarchical view of data in a table.
|
|
@@ -28,6 +34,8 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
28
34
|
*/
|
|
29
35
|
@api isLoading = false;
|
|
30
36
|
|
|
37
|
+
_selectedRowKeys = [];
|
|
38
|
+
|
|
31
39
|
/**
|
|
32
40
|
* Required for better performance. Associates each row with a unique ID.
|
|
33
41
|
* @type {string}
|
|
@@ -74,7 +82,7 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
74
82
|
* The array of unique row IDs that are selected.
|
|
75
83
|
* @type {array}
|
|
76
84
|
*/
|
|
77
|
-
|
|
85
|
+
//@api selectedRows = [];
|
|
78
86
|
|
|
79
87
|
/**
|
|
80
88
|
* If present, the row number column are shown in the first column.
|
|
@@ -86,6 +94,7 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
86
94
|
@track _columns;
|
|
87
95
|
@track _data;
|
|
88
96
|
@track _expandedRows = [];
|
|
97
|
+
@track _selectedRows = [];
|
|
89
98
|
|
|
90
99
|
constructor() {
|
|
91
100
|
super();
|
|
@@ -99,6 +108,10 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
99
108
|
); // event received by the tree column header
|
|
100
109
|
}
|
|
101
110
|
|
|
111
|
+
connectedCallback() {
|
|
112
|
+
this._selectedRowKeys = this.selectedRows.slice();
|
|
113
|
+
}
|
|
114
|
+
|
|
102
115
|
set columns(value) {
|
|
103
116
|
this._rawColumns = value;
|
|
104
117
|
this._columns = normalizeColumns(value);
|
|
@@ -159,6 +172,15 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
159
172
|
return this._data;
|
|
160
173
|
}
|
|
161
174
|
|
|
175
|
+
getSelectedRowKeys(rowKeys) {
|
|
176
|
+
let selRowKeys = [];
|
|
177
|
+
rowKeys.forEach((row) => {
|
|
178
|
+
// eslint-disable-next-line no-unused-expressions
|
|
179
|
+
selRowKeys.push(row.name);
|
|
180
|
+
});
|
|
181
|
+
return selRowKeys;
|
|
182
|
+
}
|
|
183
|
+
|
|
162
184
|
// Methods
|
|
163
185
|
|
|
164
186
|
/**
|
|
@@ -187,6 +209,7 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
187
209
|
@api
|
|
188
210
|
expandAll() {
|
|
189
211
|
this.toggleAllRows(this.data, true);
|
|
212
|
+
this._selectedRows = this._selectedRowKeys.slice();
|
|
190
213
|
}
|
|
191
214
|
|
|
192
215
|
/**
|
|
@@ -195,6 +218,7 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
195
218
|
@api
|
|
196
219
|
collapseAll() {
|
|
197
220
|
this.toggleAllRows(this.data, false);
|
|
221
|
+
this._selectedRows = this._selectedRowKeys.slice();
|
|
198
222
|
}
|
|
199
223
|
|
|
200
224
|
/**
|
|
@@ -210,6 +234,13 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
210
234
|
this._ariaLabel = value;
|
|
211
235
|
}
|
|
212
236
|
|
|
237
|
+
handleRowDeSelection(event) {
|
|
238
|
+
event.stopPropagation();
|
|
239
|
+
const { rowKeyValue } = event.detail;
|
|
240
|
+
let index = this._selectedRowKeys.indexOf(rowKeyValue);
|
|
241
|
+
this._selectedRowKeys.splice(index, 1);
|
|
242
|
+
}
|
|
243
|
+
|
|
213
244
|
// Event handlers
|
|
214
245
|
|
|
215
246
|
handleToggle(event) {
|
|
@@ -217,6 +248,15 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
217
248
|
const { name, nextState } = event.detail;
|
|
218
249
|
// toggle row in user provided data
|
|
219
250
|
this.toggleRow(this.data, name, nextState);
|
|
251
|
+
this._selectedRows = this._selectedRowKeys.slice();
|
|
252
|
+
}
|
|
253
|
+
@api
|
|
254
|
+
set selectedRows(value) {
|
|
255
|
+
this._selectedRowKeys = this._selectedRows = value;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
get selectedRows() {
|
|
259
|
+
return this._selectedRows;
|
|
220
260
|
}
|
|
221
261
|
|
|
222
262
|
handleToggleAll(event) {
|
|
@@ -224,11 +264,36 @@ export default class LightningTreeGrid extends LightningElement {
|
|
|
224
264
|
const { nextState } = event.detail;
|
|
225
265
|
// toggle all rows in user provided data
|
|
226
266
|
this.toggleAllRows(this.data, nextState);
|
|
267
|
+
this._selectedRows = this._selectedRowKeys.slice();
|
|
227
268
|
}
|
|
228
269
|
|
|
229
270
|
handleRowSelection(event) {
|
|
230
271
|
event.stopPropagation();
|
|
231
272
|
// pass the event through
|
|
273
|
+
switch (event.detail.config.selection) {
|
|
274
|
+
case ROWS_ACTION.ROW_SELECT:
|
|
275
|
+
this._selectedRowKeys.push(event.detail.config.value);
|
|
276
|
+
break;
|
|
277
|
+
case ROWS_ACTION.ROW_DESELECT: {
|
|
278
|
+
const index = this._selectedRowKeys.indexOf(
|
|
279
|
+
event.detail.config.value
|
|
280
|
+
);
|
|
281
|
+
this._selectedRowKeys.splice(index, 1);
|
|
282
|
+
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
case ROWS_ACTION.SELECT_ALL_ROWS:
|
|
286
|
+
case ROWS_ACTION.DESELECT_ALL_ROWS:
|
|
287
|
+
this._selectedRowKeys = this.getSelectedRowKeys(
|
|
288
|
+
event.detail.selectedRows
|
|
289
|
+
);
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
this._selectedRowKeys.push(event.detail.config.value);
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
delete event.detail.config; // to prevent further propagation of the config
|
|
296
|
+
|
|
232
297
|
this.fireSelectedRowsChange(event.detail);
|
|
233
298
|
}
|
|
234
299
|
|
|
@@ -4,7 +4,7 @@ export const urlRegexString =
|
|
|
4
4
|
"((?:(?:https?|ftp):\\/\\/(?:[\\w\\-\\|=%~#\\/+*@\\.,;:\\?!']|&){0,2047}(?:[\\(\\)\\.\\w=\\/+#-]*)[^\\s()\\.<>,;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0ZWM56D|XN--11B5BS3A9AJ6G|XN--80AKHBYKNJ4F|XN--9T4B11YI5A|XN--DEBA0AD|XN--FIQS8S|XN--FIQZ9S|XN--G6W251D|XN--HGBK6AJ7F53BBA|XN--HLCJ6AYA9ESC7A|XN--J6W193G|XN--JXALPDLP|XN--KGBECHTV|XN--KPRW13D|XN--KPRY57D|XN--MGBAAM7A8H|XN--MGBERP4A5D4AR|XN--P1AI|XN--WGBH1C|XN--ZCKZAH|YE|YT|ZA|ZM|ZW))(?:/[\\w\\-=?/.&;:%~,+@#*]{0,2048}(?:[\\w=/+#-]|\\([^\\s()]*\\)))?(?:$|(?=\\.$)|(?=\\.\\s)|(?=[^\\w\\.]))))";
|
|
5
5
|
|
|
6
6
|
export const emailRegexString =
|
|
7
|
-
|
|
7
|
+
"([\\w-\\.\\+_']{1,64}@(?:[\\w-]){1,255}(?:\\.[\\w-]{1,255}){1,10})";
|
|
8
8
|
|
|
9
9
|
export const newLineRegexString = '(\r\n|\r|\n)';
|
|
10
10
|
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @lwc/lwc/no-async-await */
|
|
2
|
-
/* eslint-disable @lwc/lwc/no-document-query */
|
|
3
|
-
/* eslint-disable @lwc/lwc/no-async-operation */
|
|
4
|
-
/* eslint-disable @lwc/lwc/no-rest-parameter */
|
|
5
|
-
/* eslint-disable no-await-in-loop */
|
|
6
|
-
import { createElement } from 'lwc';
|
|
7
|
-
import Basic from 'x/basic';
|
|
8
|
-
|
|
9
|
-
function createHtml(props = {}) {
|
|
10
|
-
const element = createElement('x-basic', { is: Basic });
|
|
11
|
-
Object.assign(element, props);
|
|
12
|
-
document.body.appendChild(element);
|
|
13
|
-
return element;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function wait(ms) {
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
setTimeout(resolve, ms);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function waitFor(callback) {
|
|
23
|
-
let msToWait = [50, 100, 150, 200, 250, 500, 1000];
|
|
24
|
-
let waiting = true;
|
|
25
|
-
while (waiting) {
|
|
26
|
-
let [msToWaitNow, ...msToWaitNext] = msToWait;
|
|
27
|
-
msToWait = msToWaitNext;
|
|
28
|
-
if (msToWaitNow !== undefined) {
|
|
29
|
-
await wait(msToWaitNow);
|
|
30
|
-
if (callback()) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
describe('lightning-formatted-address', () => {
|
|
39
|
-
it('should render the address with map', async () => {
|
|
40
|
-
const element = createHtml();
|
|
41
|
-
|
|
42
|
-
const formattedAddress = element.shadowRoot.querySelector(
|
|
43
|
-
'lightning-formatted-address'
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const staticMap = formattedAddress.shadowRoot.querySelector(
|
|
47
|
-
'lightning-static-map'
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const updated = await waitFor(() => {
|
|
51
|
-
const iframe = staticMap.shadowRoot
|
|
52
|
-
.querySelector('lightning-primitive-iframe')
|
|
53
|
-
.shadowRoot.querySelector('iframe');
|
|
54
|
-
|
|
55
|
-
const value = iframe.style.display;
|
|
56
|
-
|
|
57
|
-
return value === 'inherit';
|
|
58
|
-
});
|
|
59
|
-
expect(updated).toBeTruthy();
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'lwc';
|
|
2
|
-
|
|
3
|
-
import Element from 'lightning/formattedAddress';
|
|
4
|
-
|
|
5
|
-
function createHtml(props = {}) {
|
|
6
|
-
const element = createElement('x-basic', { is: Element });
|
|
7
|
-
Object.assign(element, props);
|
|
8
|
-
document.body.appendChild(element);
|
|
9
|
-
return element;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
describe('lightning-formatted-address', () => {
|
|
13
|
-
it('should disable component', () => {
|
|
14
|
-
const element = createHtml({
|
|
15
|
-
disabled: true,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
expect(element.disabled).toBeTruthy();
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { LightningElement, track } from 'lwc';
|
|
2
|
-
|
|
3
|
-
export default class Basic extends LightningElement {
|
|
4
|
-
@track label = 'Click here!';
|
|
5
|
-
|
|
6
|
-
handleClick() {
|
|
7
|
-
this.label = 'Clicked!';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
handleFocus() {
|
|
11
|
-
this.label = 'Focused!';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
handleBlur() {
|
|
15
|
-
this.label = 'Blurred!';
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'lwc';
|
|
2
|
-
import Element from 'lightning/input';
|
|
3
|
-
|
|
4
|
-
const defaultParams = {
|
|
5
|
-
name: 'input',
|
|
6
|
-
label: 'input',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const createInput = (params = {}) => {
|
|
10
|
-
const element = createElement('lightning-input', { is: Element });
|
|
11
|
-
Object.assign(element, defaultParams, params);
|
|
12
|
-
document.body.appendChild(element);
|
|
13
|
-
// set up some required attributes
|
|
14
|
-
return element;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
describe('lightning-input type=checkbox', () => {
|
|
18
|
-
const type = 'checkbox';
|
|
19
|
-
|
|
20
|
-
it('should be valid when set from false to true', () => {
|
|
21
|
-
const element = createInput({
|
|
22
|
-
type,
|
|
23
|
-
checked: true,
|
|
24
|
-
required: true,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return Promise.resolve()
|
|
28
|
-
.then(() => {
|
|
29
|
-
expect(element.validity.valid).toBe(true);
|
|
30
|
-
element.checked = false;
|
|
31
|
-
})
|
|
32
|
-
.then(() => {
|
|
33
|
-
expect(element.validity.valid).toBe(false);
|
|
34
|
-
element.checked = true;
|
|
35
|
-
})
|
|
36
|
-
.then(() => {
|
|
37
|
-
expect(element.validity.valid).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should not allow selectionStart or selectionEnd to be set', () => {
|
|
42
|
-
const element = createInput({
|
|
43
|
-
type,
|
|
44
|
-
checked: true,
|
|
45
|
-
required: true,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
element.focus();
|
|
49
|
-
|
|
50
|
-
return Promise.resolve().then(() => {
|
|
51
|
-
expect(() => {
|
|
52
|
-
element.selectionEnd = 7;
|
|
53
|
-
}).toThrow();
|
|
54
|
-
|
|
55
|
-
expect(() => {
|
|
56
|
-
element.selectionStart = 7;
|
|
57
|
-
}).toThrow();
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'lwc';
|
|
2
|
-
import Element from 'lightning/input';
|
|
3
|
-
|
|
4
|
-
const defaultParams = {
|
|
5
|
-
name: 'input',
|
|
6
|
-
label: 'input',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const createInput = (params = {}) => {
|
|
10
|
-
const element = createElement('lightning-input', { is: Element });
|
|
11
|
-
Object.assign(element, defaultParams, params);
|
|
12
|
-
document.body.appendChild(element);
|
|
13
|
-
// set up some required attributes
|
|
14
|
-
return element;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
describe('lightning-input type=date', () => {
|
|
18
|
-
it('should have autocomplete set to off', () => {
|
|
19
|
-
const element = createInput({
|
|
20
|
-
type: 'date',
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
return Promise.resolve().then(() => {
|
|
24
|
-
const picker = element.shadowRoot.querySelector(
|
|
25
|
-
'lightning-datepicker'
|
|
26
|
-
);
|
|
27
|
-
expect(picker.autocomplete).toBe('off');
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('lightning-input type=time', () => {
|
|
33
|
-
it('should have autocomplete set to off', () => {
|
|
34
|
-
const element = createInput({
|
|
35
|
-
type: 'time',
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return Promise.resolve().then(() => {
|
|
39
|
-
const picker = element.shadowRoot.querySelector(
|
|
40
|
-
'lightning-timepicker'
|
|
41
|
-
);
|
|
42
|
-
expect(picker.autocomplete).toBe('off');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
describe('lightning-input type=datetime', () => {
|
|
48
|
-
it('should have autocomplete set to off', () => {
|
|
49
|
-
const element = createInput({
|
|
50
|
-
type: 'datetime',
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return Promise.resolve().then(() => {
|
|
54
|
-
const picker = element.shadowRoot.querySelector(
|
|
55
|
-
'lightning-datetimepicker'
|
|
56
|
-
);
|
|
57
|
-
expect(picker.autocomplete).toBe('off');
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'lwc';
|
|
2
|
-
import Tall from 'x/tall';
|
|
3
|
-
import { animationFrame } from 'lightning/utilsPrivate';
|
|
4
|
-
|
|
5
|
-
const createTallPageWithInput = (params = {}) => {
|
|
6
|
-
const element = createElement('x-tall', { is: Tall });
|
|
7
|
-
Object.assign(element, params);
|
|
8
|
-
return element;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
describe('lightning-input type=number', () => {
|
|
12
|
-
describe('focus', () => {
|
|
13
|
-
let element;
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
element = createTallPageWithInput();
|
|
16
|
-
document.body.appendChild(element);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
afterEach(() => {
|
|
20
|
-
document.body.removeChild(element);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should scroll into view when focused', async () => {
|
|
24
|
-
const root = document.querySelector('x-tall').shadowRoot;
|
|
25
|
-
|
|
26
|
-
// Measure where the elements are on the page so we can tell later if they're on-screen.
|
|
27
|
-
let inputY =
|
|
28
|
-
window.pageYOffset +
|
|
29
|
-
root.querySelector('lightning-input').getBoundingClientRect().y;
|
|
30
|
-
let buttonY =
|
|
31
|
-
window.pageYOffset +
|
|
32
|
-
root.querySelector('button').getBoundingClientRect().y;
|
|
33
|
-
|
|
34
|
-
// 1. Focus the button at the bottom
|
|
35
|
-
root.querySelector('button').scrollIntoView();
|
|
36
|
-
root.querySelector('button').focus();
|
|
37
|
-
|
|
38
|
-
expect(document.activeElement.tagName.toLowerCase()).toBe(
|
|
39
|
-
'x-tall',
|
|
40
|
-
'the focused component should be x-tall'
|
|
41
|
-
);
|
|
42
|
-
expect(root.activeElement.tagName.toLowerCase()).toBe(
|
|
43
|
-
'button',
|
|
44
|
-
'the focused element in x-tall should be the button'
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const isButtonOnScreen =
|
|
48
|
-
buttonY >= window.pageYOffset &&
|
|
49
|
-
buttonY <= window.pageYOffset + window.innerHeight;
|
|
50
|
-
expect(isButtonOnScreen).toBe(
|
|
51
|
-
true,
|
|
52
|
-
'Page did not scroll when the button was focused.'
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
// 2. Click the button to send focus to the input
|
|
56
|
-
root.querySelector('button').click();
|
|
57
|
-
|
|
58
|
-
// Click has async text selection, so we wait a moment for the browser to actually move focus.
|
|
59
|
-
await animationFrame();
|
|
60
|
-
|
|
61
|
-
expect(root.activeElement.tagName.toLowerCase()).toBe(
|
|
62
|
-
'lightning-input',
|
|
63
|
-
'active element was not lightning-input'
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const isInputOnScreen =
|
|
67
|
-
inputY >= window.pageYOffset &&
|
|
68
|
-
inputY <= window.pageYOffset + window.innerHeight;
|
|
69
|
-
expect(isInputOnScreen).toBe(
|
|
70
|
-
true,
|
|
71
|
-
'Page did not scroll to input when focus was sent there.'
|
|
72
|
-
);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { createElement } from 'lwc';
|
|
2
|
-
import Element from 'lightning/input';
|
|
3
|
-
|
|
4
|
-
const defaultParams = {
|
|
5
|
-
name: 'input',
|
|
6
|
-
label: 'input',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const ERROR_INPUT_TYPES = ['range', 'file', 'checkbox'];
|
|
10
|
-
|
|
11
|
-
const VALID_INPUT_TYPES_W_VALUE = [
|
|
12
|
-
// the W3 standards
|
|
13
|
-
['text', 'default string of joy'],
|
|
14
|
-
['search', 'beavis inc'],
|
|
15
|
-
['tel', 345987345],
|
|
16
|
-
['url', 'http://www.beavis.com'],
|
|
17
|
-
['password', 'beavis9000'],
|
|
18
|
-
|
|
19
|
-
// some of the components that work bc our component is an enhancement above w3!
|
|
20
|
-
['email', 'acdc@beavis.com'],
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
const createInput = (params = {}) => {
|
|
24
|
-
const element = createElement('lightning-input', { is: Element });
|
|
25
|
-
Object.assign(element, defaultParams, params);
|
|
26
|
-
document.body.appendChild(element);
|
|
27
|
-
return element;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
describe('lightning-input', () => {
|
|
31
|
-
describe('selectionStart and selectionEnd', () => {
|
|
32
|
-
let element = null;
|
|
33
|
-
afterEach(() => {
|
|
34
|
-
document.body.removeChild(element);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
ERROR_INPUT_TYPES.forEach((type) => {
|
|
38
|
-
it(`should not allow selectionStart or selectionEnd to be set when type is ${type}`, () => {
|
|
39
|
-
element = createInput({
|
|
40
|
-
type,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
element.focus();
|
|
44
|
-
return Promise.resolve().then(() => {
|
|
45
|
-
expect(() => {
|
|
46
|
-
element.selectionStart = 3;
|
|
47
|
-
}).toThrow();
|
|
48
|
-
|
|
49
|
-
expect(() => {
|
|
50
|
-
element.selectionEnd = 7;
|
|
51
|
-
}).toThrow();
|
|
52
|
-
|
|
53
|
-
expect(element.selectionStart).toBe(null);
|
|
54
|
-
expect(element.selectionEnd).toBe(null);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
VALID_INPUT_TYPES_W_VALUE.forEach(([type, value]) => {
|
|
60
|
-
it(`should be valid when set after focus when type is ${type} w/ ${value}`, () => {
|
|
61
|
-
element = createInput({
|
|
62
|
-
type,
|
|
63
|
-
value,
|
|
64
|
-
required: true,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
element.focus();
|
|
68
|
-
element.selectionStart = 3;
|
|
69
|
-
element.selectionEnd = 7;
|
|
70
|
-
|
|
71
|
-
const inputElement = element.shadowRoot.querySelector('input');
|
|
72
|
-
|
|
73
|
-
return Promise.resolve().then(() => {
|
|
74
|
-
expect(inputElement.selectionStart).toBe(3);
|
|
75
|
-
expect(inputElement.selectionEnd).toBe(7);
|
|
76
|
-
|
|
77
|
-
expect(element.selectionStart).toBe(3);
|
|
78
|
-
expect(element.selectionEnd).toBe(7);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
});
|