Skip to content

Commit

Permalink
fix: propagate autocapitalize attribute in Chrome (#5175)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Dec 28, 2022
1 parent 46002f3 commit d82ca0a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
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
47 changes: 47 additions & 0 deletions packages/field-base/test/input-field-mixin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,53 @@ describe('input-field-mixin', () => {
});
});

describe('attributes', () => {
describe('autocomplete', () => {
beforeEach(() => {
element = fixtureSync(`<input-field-mixin-element autocomplete="on"></input-field-mixin-element>`);
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(() => {
element = fixtureSync(`<input-field-mixin-element autocorrect="on"></input-field-mixin-element>`);
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(() => {
element = fixtureSync(`<input-field-mixin-element autocapitalize="characters"></input-field-mixin-element>`);
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('validation', () => {
beforeEach(() => {
element = fixtureSync('<input-field-mixin-element></input-field-mixin-element>');
Expand Down

0 comments on commit d82ca0a

Please sign in to comment.