WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
67173
Add a test for lastChangeWasUserEdit in HTMLInputElement and HTMLTextAreaElement
https://bugs.webkit.org/show_bug.cgi?id=67173
Summary
Add a test for lastChangeWasUserEdit in HTMLInputElement and HTMLTextAreaElement
Ryosuke Niwa
Reported
2011-08-29 18:23:40 PDT
We should have a test for lastChangeWasUserEdit per the discussion on the
bug 67152
Attachments
adds a basic test
(8.63 KB, patch)
2011-08-29 18:27 PDT
,
Ryosuke Niwa
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2011-08-29 18:27:28 PDT
Created
attachment 105557
[details]
adds a basic test
Darin Adler
Comment 2
2011-08-29 18:35:32 PDT
Comment on
attachment 105557
[details]
adds a basic test View in context:
https://bugs.webkit.org/attachment.cgi?id=105557&action=review
> Source/WebCore/testing/Internals.cpp:275 > + if (HTMLInputElement* input = textField->toInputElement())
Wow, never saw this function before. Having toInputElement is crazy. Did we really add that?! Why have this for one specific element type?
> LayoutTests/fast/forms/textfield-lastchange-was-useredit.html:13 > +if (!window.layoutTestController || !window.internals)
This is the only line of code that needs to say "window." in its expression.
> LayoutTests/fast/forms/textfield-lastchange-was-useredit.html:22 > + shouldBeFalse('window.internals.wasLastChangeUserEdit(textField)');
Just internals would be fine.
> LayoutTests/fast/forms/textfield-lastchange-was-useredit.html:26 > + textField.value = 'hello'; > + debug('\nAfter setting value'); > + shouldBeFalse('window.internals.wasLastChangeUserEdit(textField)');
Another way to write this is: shouldBeFalse("textField.value = 'hello'; internals.wasLastChangeUserEdit(textField)"); Using lines like that makes the test output less wordy than all those debug statements.
> LayoutTests/fast/forms/textfield-lastchange-was-useredit.html:59 > + textField.textContent = "hello\nworld"; > + debug('\nAfter modifying textContent'); > + shouldBeFalse('window.internals.wasLastChangeUserEdit(textField)');
Maybe should test modifying innerText too?
Kent Tamura
Comment 3
2011-08-29 18:41:23 PDT
Comment on
attachment 105557
[details]
adds a basic test View in context:
https://bugs.webkit.org/attachment.cgi?id=105557&action=review
>> Source/WebCore/testing/Internals.cpp:275 >> + if (HTMLInputElement* input = textField->toInputElement()) > > Wow, never saw this function before. Having toInputElement is crazy. Did we really add that?! Why have this for one specific element type?
I think it was for WML-HTML abstraction. toInputElement() returned dom/InputElement.
Darin Adler
Comment 4
2011-08-29 18:43:28 PDT
Comment on
attachment 105557
[details]
adds a basic test View in context:
https://bugs.webkit.org/attachment.cgi?id=105557&action=review
>>> Source/WebCore/testing/Internals.cpp:275 >>> + if (HTMLInputElement* input = textField->toInputElement()) >> >> Wow, never saw this function before. Having toInputElement is crazy. Did we really add that?! Why have this for one specific element type? > > I think it was for WML-HTML abstraction. toInputElement() returned dom/InputElement.
I think we should stop using it, use hasTagName(inputTag) instead, and get rid of it.
Ryosuke Niwa
Comment 5
2011-08-29 18:47:44 PDT
Thanks for the review! THAT was quick. (In reply to
comment #3
)
> (From update of
attachment 105557
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=105557&action=review
> > >> Source/WebCore/testing/Internals.cpp:275 > >> + if (HTMLInputElement* input = textField->toInputElement()) > > > > Wow, never saw this function before. Having toInputElement is crazy. Did we really add that?! Why have this for one specific element type? > > I think it was for WML-HTML abstraction. toInputElement() returned dom/InputElement.
I'll avoid using this function then. (In reply to
comment #2
)
> > LayoutTests/fast/forms/textfield-lastchange-was-useredit.html:13 > > +if (!window.layoutTestController || !window.internals) > > This is the only line of code that needs to say "window." in its expression.
Oops, you're right. Will remove "window." from other lines.
> > LayoutTests/fast/forms/textfield-lastchange-was-useredit.html:26 > > + textField.value = 'hello'; > > + debug('\nAfter setting value'); > > + shouldBeFalse('window.internals.wasLastChangeUserEdit(textField)'); > > Another way to write this is: > > shouldBeFalse("textField.value = 'hello'; internals.wasLastChangeUserEdit(textField)"); > > Using lines like that makes the test output less wordy than all those debug statements.
Okay. I guess I'll change to that style for simple cases.
> > LayoutTests/fast/forms/textfield-lastchange-was-useredit.html:59 > > + textField.textContent = "hello\nworld"; > > + debug('\nAfter modifying textContent'); > > + shouldBeFalse('window.internals.wasLastChangeUserEdit(textField)'); > > Maybe should test modifying innerText too?
That's a good point. Will do.
Ryosuke Niwa
Comment 6
2011-08-29 18:49:14 PDT
(In reply to
comment #4
)
> > I think it was for WML-HTML abstraction. toInputElement() returned dom/InputElement. > > I think we should stop using it, use hasTagName(inputTag) instead, and get rid of it.
Enthusiastically agreed. Filed
https://bugs.webkit.org/show_bug.cgi?id=67175
.
Ryosuke Niwa
Comment 7
2011-08-29 19:02:49 PDT
Committed
r94038
: <
http://trac.webkit.org/changeset/94038
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug