Summary: | Add a test for lastChangeWasUserEdit in HTMLInputElement and HTMLTextAreaElement | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> | ||||
Component: | WebKit API | Assignee: | Ryosuke Niwa <rniwa> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | adele, ap, darin, dglazkov, morrita, sam, tkent | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 67152 | ||||||
Attachments: |
|
Description
Ryosuke Niwa
2011-08-29 18:23:40 PDT
Created attachment 105557 [details]
adds a basic test
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? 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. 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. 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. (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. Committed r94038: <http://trac.webkit.org/changeset/94038> |