-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Error when attempting to fillIn
/typeIn
a disabled form control
#741
Conversation
a0b6bac
to
cc05c63
Compare
not sure what does fail on CI, it just says:
w/o any context. |
hm.. turns out, in
I think it should throw. Will update. |
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go once click
has been updated to throw (along with tests).
Thanks for picking this up @ro0gr!
@rwjblue thanks for the feedback and sorry for letting it hang, going to come back to it this week. |
No problem, thanks for working on it! |
cc05c63
to
aeb11e6
Compare
Just added an error for But a slight doubt appeared on my mind. I suspect it might be considered a breaking change, since we didn't fail on clicking disableds before. I'm pretty sure there are some tests in the wild, like: this.doSmth = () => {
this.called = true
}
await render(hbs`<Something
@disabled={{true}}
@onClick={{this.doSmth}}
/>`
await click('.Something');
assert.equal(called, false) which I believe is totally valid with existing click implementation, but would fail with this proposed change. From the other hand, not throwing for disableds in @rwjblue please let me know, what do you think? Should I split the PR into 2, in order to merge |
aeb11e6
to
93f3870
Compare
93f3870
to
f4ffd29
Compare
extracted everything unrelated to |
9815988
to
6c063ff
Compare
function isFocusableElement( | ||
element: HTMLElement | SVGElement | Element | ||
): element is FocusableElement { | ||
function isFocusableElement(element: Element): element is FocusableElement { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you change the types here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was my attempt to simlify a bit. Both HTMLElement
are SVGElement
derrive from Element
, so it does seem redundant to specify each.
Also, implementation wise it just checks if it's not an A
tag!
tests/unit/dom/fill-in-test.js
Outdated
await setupContext(context); | ||
assert.rejects( | ||
fillIn(`#${element.id}`, 'foo'), | ||
new Error('Can not `fillIn` disabled [object HTMLInputElement]') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have [object HTMLInputElement]
in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are passing an element instace, which is not focusable, into throw statement. Should prbably change it to use specifier(selector or Element) passed by user. Will update, thanks!
4815778
to
158650c
Compare
|
||
assert.rejects( | ||
fillIn(element, 'foo'), | ||
new Error("Can not `fillIn` disabled '[object HTMLInputElement]'."), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Turbo87 just improved error messages. See this one, and 1 assert above. Please let me know if it looks good for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, I think it will need a rebase to fix some conflicts but we should be able to land and get it out in 2.0.0.
158650c
to
c2d5efb
Compare
CI is failing due to some conflicts in ember-data/ember types. I suspect this was caused by this PR #784, which doesn't have travis results reported in the PR for some reason, so we've missed the breakage. I think it's a good time to upgrade that types and ec-ts at once. Will look into it. |
I rerolled the yarn.lock in #814 (since floating deps tests worked), mind trying again? |
c2d5efb
to
52d92bb
Compare
fillIn
/typeIn
a disabled form control
fixes: #680
continues: #681
With this PR
fillIn
andtypeIn
helpers start to fail on attempt to interact withdisabled
form controls.There is a follow up PR, doing a similar thing for readonly(#779). Extracted it to make review easier.
my original intention was also to cover
click
anddoubleclick
and the rest of interaction helpers with the same logic, but seems they intentionally just skip focus for non-focusable elements:ember-test-helpers/addon-test-support/@ember/test-helpers/dom/click.ts
Lines 18 to 20 in f053fe0
Assuming changing of this behavior, might be considered a breaking change, I've extracted this part as a separate follow-up PR(#778)