How to use the lightning/testUtils.shadowQuerySelector function in lightning

To help you get started, we’ve selected a few lightning examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github salesforce / base-components-recipes / force-app / main / default / lwc / progressBar / __tests__ / progressBar.spec.js View on Github external
it('should not have aria-busy when the value is then 0', () => {
        const element = createProgressBar({
            value: 0
        });

        const processDiv = shadowQuerySelector(element, '.slds-progress-bar');
        expect(processDiv.getAttribute('aria-busy')).toBeNull();
    });
    it('should not have aria-busy when the value is then 100', () => {
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
            const form = shadowQuerySelector(
                element,
                'lightning-record-edit-form'
            );

            element.submit({ foo: 'bar' });
            expect(form.getSubmitData()).toEqual({ foo: 'bar' });
        });
    });
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
            const form = shadowQuerySelector(
                element,
                'lightning-record-edit-form'
            );

            form.dispatchEvent(
                new CustomEvent('load', {
                    detail: {
                        objectInfos: { Lead: store.objectInfo },
                        layout: store.layouts.Lead.Full.View,
                        records: store.records
                    }
                })
            );

            return Promise.resolve().then(() => {
                const inputFields = shadowQuerySelectorAll(
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
            const form = shadowQuerySelector(
                element,
                'lightning-record-edit-form'
            );

            expect(form.layoutType).toEqual('Full');
        });
    });
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
                    const inputField = shadowQuerySelector(
                        element,
                        'lightning-input-field'
                    );

                    expect(inputField.value).toBe('initial');
                });
            });
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
                const el = shadowQuerySelector(
                    element,
                    'lightning-button.lightning-record-form-cancel'
                );

                shadowQuerySelector(element, 'lightning-input-field').value =
                    'banana';
                shadowQuerySelector(el, 'button').click();
                return Promise.resolve().then(() => {
                    const inputField = shadowQuerySelector(
                        element,
                        'lightning-input-field'
                    );

                    expect(inputField.value).toBe('initial');
                });
            });
        });
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
                const el = shadowQuerySelector(
                    element,
                    'lightning-button.lightning-record-form-cancel'
                );

                shadowQuerySelector(element, 'lightning-input-field').value =
                    'banana';
                shadowQuerySelector(el, 'button').click();
                return Promise.resolve().then(() => {
                    const inputField = shadowQuerySelector(
                        element,
                        'lightning-input-field'
                    );

                    expect(inputField.value).toBe('initial');
                });
            });
        });
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
            const form = shadowQuerySelector(
                element,
                'lightning-record-edit-form'
            );

            expect(form.recordTypeId).toEqual('foo');
        });
    });
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
            const cancelButtonElement = shadowQuerySelector(
                element,
                'lightning-button.lightning-record-form-cancel'
            );

            shadowQuerySelector(element, 'lightning-messages').setError(
                'an error'
            );

            shadowQuerySelector(cancelButtonElement, 'button').click();

            return Promise.resolve().then(() => {
                const errorMessagesElement = shadowQuerySelector(
                    element,
                    'lightning-messages'
                );

                expect(errorMessagesElement.error.message).toBe('');
                expect(errorMessagesElement.textContent).toBe('');
            });
        });
    });
github salesforce / base-components-recipes / force-app / main / default / lwc / recordForm / __tests__ / recordForm.spec.js View on Github external
return Promise.resolve().then(() => {
                const errorMessagesElement = shadowQuerySelector(
                    element,
                    'lightning-messages'
                );

                expect(errorMessagesElement.error.message).toBe('');
                expect(errorMessagesElement.textContent).toBe('');
            });
        });