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) (CP: 23.3) #5176

Merged
merged 1 commit 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 @@ -67,6 +67,56 @@ describe('input-field-mixin', () => {
});
});

describe('attributes', () => {
describe('autocomplete', () => {
beforeEach(async () => {
element = fixtureSync(`<input-field-mixin-element autocomplete="on"></input-field-mixin-element>`);
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(`<input-field-mixin-element autocorrect="on"></input-field-mixin-element>`);
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(`<input-field-mixin-element autocapitalize="characters"></input-field-mixin-element>`);
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
2 changes: 2 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 @@ -26,6 +26,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 @@ -127,6 +128,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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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 @@ -152,6 +153,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