Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: propagate autocapitalize attribute in Chrome #5175

Merged
merged 2 commits into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/field-base/src/input-field-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const InputFieldMixin = (superclass) =>
*/
autocapitalize: {
type: String,
reflectToAttribute: true,
},
};
}
Expand Down
50 changes: 50 additions & 0 deletions packages/field-base/test/input-field-mixin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,56 @@ const runTests = (baseClass) => {
});
});

describe('attributes', () => {
describe('autocomplete', () => {
beforeEach(async () => {
element = fixtureSync(`<${tag} autocomplete="on"></${tag}>`);
await nextRender();
input = element.querySelector('[slot=input]');
});

it('should set autocomplete property on the host element', () => {
expect(element.autocomplete).to.equal('on');
});

it('should propagate autocomplete attribute to the input', () => {
expect(input.autocomplete).to.equal('on');
});
});

describe('autocorrect', () => {
beforeEach(async () => {
element = fixtureSync(`<${tag} autocorrect="on"></${tag}>`);
await nextRender();
input = element.querySelector('[slot=input]');
});

it('should set autocorrect property on the host element', () => {
expect(element.autocorrect).to.equal('on');
});

it('should propagate autocorrect attribute to the input', () => {
expect(input.getAttribute('autocorrect')).to.equal('on');
});
});

describe('autocapitalize', () => {
beforeEach(async () => {
element = fixtureSync(`<${tag} autocapitalize="characters"></${tag}>`);
await nextRender();
input = element.querySelector('[slot=input]');
});

it('should set autocapitalize property on the host element', () => {
expect(element.autocapitalize).to.equal('characters');
});

it('should propagate autocapitalize attribute to the input', () => {
expect(input.getAttribute('autocapitalize')).to.equal('characters');
});
});
});

describe('initial validation', () => {
let validateSpy;

Expand Down
3 changes: 3 additions & 0 deletions packages/login/test/dom/__snapshots__/login-form.test.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ snapshots["vaadin-login-form host default"] =
>
<input
aria-labelledby="label-vaadin-text-field-0"
autocapitalize="none"
autocomplete="username"
autocorrect="off"
id="input-vaadin-text-field-6"
Expand Down Expand Up @@ -132,6 +133,7 @@ snapshots["vaadin-login-form host i18n"] =
>
<input
aria-labelledby="label-vaadin-text-field-0"
autocapitalize="none"
autocomplete="username"
autocorrect="off"
id="input-vaadin-text-field-6"
Expand Down Expand Up @@ -239,6 +241,7 @@ snapshots["vaadin-login-form host noForgotPassword"] =
>
<input
aria-labelledby="label-vaadin-text-field-0"
autocapitalize="none"
autocomplete="username"
autocorrect="off"
id="input-vaadin-text-field-6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ snapshots["vaadin-login-overlay host default"] =
>
<input
aria-labelledby="label-vaadin-text-field-0"
autocapitalize="none"
autocomplete="username"
autocorrect="off"
id="input-vaadin-text-field-6"
Expand Down Expand Up @@ -151,6 +152,7 @@ snapshots["vaadin-login-overlay host i18n"] =
>
<input
aria-labelledby="label-vaadin-text-field-0"
autocapitalize="none"
autocomplete="username"
autocorrect="off"
id="input-vaadin-text-field-6"
Expand Down