-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] Automated test case for issue 4542 (Quotes Issue With JavaScr…
…ipt Function Calls Inside Inline Event Handlers) http://code.google.com/p/fbug/issues/detail?id=4542 Removed old manual test case git-svn-id: http://fbug.googlecode.com/svn@11161 e969d3be-0e28-0410-a27f-dd5c76401a8b
- Loading branch information
1 parent
6afd497
commit 825c358
Showing
3 changed files
with
92 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ <h1><a href="http://code.google.com/p/fbug/issues/detail?id=4542">Issue 4542</a> | |
</header> | ||
<div> | ||
<section id="content"> | ||
<input type="text" id="input" onkeydown="var output = document.getElementById(output'); output.style.display = 'block'; output.innerHTML = Hey, you entered something into the input field!""> | ||
<button id="sayHi" onclick="var output = document.getElementById(output'); output.style.display = 'block'; output.innerHTML = Hi there, tester!""> | ||
Say hi | ||
</button> | ||
<section id="output"> | ||
</section> | ||
</section> | ||
|
@@ -25,24 +27,26 @@ <h3>Steps to reproduce</h3> | |
<ol> | ||
<li>Open Firebug</li> | ||
<li>Switch to the HTML panel</li> | ||
<li>Inspect the input field above (<code>#input</code>)</li> | ||
<li>Click on the value of the <code>onkeydown</code> attribute to start editing</li> | ||
<li>Inspect the button above (<code>#sayHi</code>)</li> | ||
<li>Click on the value of the <code>onclick</code> attribute to start editing</li> | ||
<li>Move the text cursor between the opening bracket and <code>output</code> of <code>getElementById(output')</code></li> | ||
<li>Enter a single quote (<code>'</code>)</li> | ||
<li>Move the text cursor before the <code>H</code> of <code>Hey</code></li> | ||
<li>Enter a double quote (")</li> | ||
<li> | ||
Enter a single quote (<code>'</code>)<br/> | ||
⇒ The single quote is entered into the input field | ||
</li> | ||
<li>Move the text cursor before the <code>H</code> of <code>Hi</code></li> | ||
<li> | ||
Enter a double quote (")<br/> | ||
⇒ The double quote is entered into the input field | ||
</li> | ||
<li>Focus the input field on the page and type <code>a</code></li> | ||
</ol> | ||
<h3>Expected Result</h3> | ||
<ul> | ||
<li>After step 6: The single quote is entered into the input field</li> | ||
<li>After step 8: The double quote is entered into the input field</li> | ||
<li>After step 9: <code>Hey, you entered something into the input field!</code> shown below the input field</li> | ||
<li><code>Hi there, tester!</code> shown below the button</li> | ||
</ul> | ||
</section> | ||
<footer> | ||
Gabriel Nahmias, nahmias.gabriel at gmail.com | ||
</footer> | ||
<footer>Sebastian Zartner, [email protected]</footer> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
function runTest() | ||
{ | ||
FBTest.sysout("issue4542.START"); | ||
FBTest.openNewTab(basePath + "html/4542/issue4542.html", function(win) | ||
{ | ||
FBTest.openFirebug(); | ||
var panel = FBTest.selectPanel("html"); | ||
|
||
FBTest.selectElementInHtmlPanel("sayHi", function(node) | ||
{ | ||
var attributes = node.querySelectorAll(".nodeAttr"); | ||
var i; | ||
|
||
hasOnClickAttribute = false; | ||
for (i=0; i<attributes.length; i++) | ||
{ | ||
var nodeName = attributes[i].querySelector(".nodeName"); | ||
if (nodeName.textContent == "onclick") | ||
{ | ||
hasOnClickAttribute = true; | ||
break; | ||
} | ||
} | ||
|
||
if (FBTest.ok(hasOnClickAttribute, "There must be an 'onclick' attribute")) | ||
{ | ||
var nodeValue = attributes[i].querySelector(".nodeValue"); | ||
// Click the attribute value to open the inline editor | ||
FBTest.synthesizeMouse(nodeValue); | ||
|
||
var editor = panel.panelNode.querySelector(".textEditorInner"); | ||
if (FBTest.ok(editor, "Editor must be available now")) | ||
{ | ||
FBTest.sendKey("HOME", editor); | ||
// Move text cursor between the opening bracket and 'output' of | ||
// 'getElementById(output')' | ||
for (var i=0; i<37; i++) | ||
FBTest.sendKey("RIGHT", editor); | ||
|
||
// Enter a single quote | ||
FBTest.sendChar("'", editor); | ||
|
||
if (!FBTest.ok(editor &&editor.value.search("var output") != -1, | ||
"Editor must still be available and must not jump to the next editable " + | ||
"item when a single quote is entered")) | ||
{ | ||
FBTest.synthesizeMouse(nodeValue); | ||
editor = panel.panelNode.querySelector(".textEditorInner"); | ||
} | ||
|
||
FBTest.compare(/getElementById\('output'\)/, editor.value, "Single quote must be entered"); | ||
|
||
// Move text cursor before the 'H' of 'Hi' | ||
for (var i=0; i<61; i++) | ||
FBTest.sendKey("RIGHT", editor); | ||
|
||
// Enter a double quote | ||
FBTest.sendChar("\"", editor); | ||
|
||
if (!FBTest.ok(editor && editor.value.search("var output") != -1, | ||
"Editor must still be available and must not jump to the next editable " + | ||
"item when a double quote is entered")) | ||
{ | ||
FBTest.synthesizeMouse(nodeValue); | ||
editor = panel.panelNode.querySelector(".textEditorInner"); | ||
} | ||
|
||
FBTest.compare(/"Hi/, editor.value, "Double quote must be entered"); | ||
} | ||
|
||
FBTest.testDone("issue4542.DONE"); | ||
} | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters