Skip to content

Setting type attribue with setAttribute function#2147

Merged
JoviDeCroock merged 1 commit into
preactjs:masterfrom
Rafi993:setting-type-using-set-attribute
Nov 23, 2019
Merged

Setting type attribue with setAttribute function#2147
JoviDeCroock merged 1 commit into
preactjs:masterfrom
Rafi993:setting-type-using-set-attribute

Conversation

@Rafi993

@Rafi993 Rafi993 commented Nov 23, 2019

Copy link
Copy Markdown
Contributor

This is done to prevent crash in IE11 as mentioned in this issue #2110

@JoviDeCroock JoviDeCroock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually add a test to assert if this is done correctly to prevent future regressions

@Rafi993

Rafi993 commented Nov 23, 2019

Copy link
Copy Markdown
Contributor Author

we usually add a test to assert if this is done correctly to prevent future regressions

Sorry. I'll add test for this too.

@JoviDeCroock

Copy link
Copy Markdown
Member

No need to say sorry, just notifying thanks for tackling this

@marvinhagemeister

Copy link
Copy Markdown
Member

That's awesome, thank you so much for the PR 👍 🎉 For tests you can take a look at the existing ones. We have a few where we check if an operation throws an error via expect(() => ...).to.not.throw or something similar 👍

@Rafi993 Rafi993 force-pushed the setting-type-using-set-attribute branch from b6c328d to f6b6319 Compare November 23, 2019 14:21
@Rafi993 Rafi993 requested a review from JoviDeCroock November 23, 2019 14:29
Comment thread test/browser/render.test.js Outdated
render(<input type="date" />, scratch);
expect(scratch.childNodes).to.have.length(1);
expect(scratch.childNodes[0].nodeName).to.equal('INPUT');
expect(scratch.childNodes[0].type).to.equal('date');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should test something that more closely resembles the original bug report. The fix in this PR specifically addresses the case where setting input.date would throw an error in IE11. The test case should reflect only that. On our CI our test suite will be run in various browsers, including IE11. So we only need to check if it throws or not.

it('should not throw in IE11 with type date', () => {
  expect(() => render(<input type="date" />, scratch)).to.not.throw();
});

@Rafi993 Rafi993 force-pushed the setting-type-using-set-attribute branch from f6b6319 to 55143e6 Compare November 23, 2019 14:54

@marvinhagemeister marvinhagemeister left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, the changes look good to me 👍 💯 Again, thank you so much for the PR 🙌

@Rafi993

Rafi993 commented Nov 23, 2019

Copy link
Copy Markdown
Contributor Author

Thanks for the help @marvinhagemeister @JoviDeCroock you guys are awesome !!!

@JoviDeCroock JoviDeCroock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, you're awesome 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants