Permalink
Browse files

Move tests for command line and domplate to Firebug SVN.

  • Loading branch information...
janodvarko committed Dec 18, 2008
1 parent e91e85f commit c51e5a5746d0f550bd7adf85812f5b318e8332ce
@@ -1,160 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
-<script src="chrome://firebug/content/xpcom.js"></script>
-<script src="chrome://firebug/content/lib.js"></script>
-<script src="chrome://firebug/content/chrome.js"></script>
-<script src="chrome://firebug/content/domplate.js"></script>
-<script>
-var state = false;
-
-var a = "three";
-var b = undefined;
-var c = null;
-var d = 2;
-
-function set_d_val(td) {
- d = td;
- return d;
-}
-
-function checkText( str, msg ) {
- var divs = fireunit.panel("console").getElementsByTagName("div");
- fireunit.ok( divs.length > 0, msg + " " + str);
- if (divs.length) {
- var result = divs[ divs.length - 1 ].innerHTML;
- fireunit.reCompare( str, result, msg );
- }
-}
-
-function clear(){
- fireunit.click( fireunit.chromeID( "fbConsoleButtons" ).getElementsByTagName("toolbarbutton")[0] );
-}
-
-window.onload = function(){
-
- var oldThrottle = Application.prefs.getValue("extensions.firebug.throttleMessages", true);
-
- Application.prefs.setValue("extensions.firebug.throttleMessages", false);
-
- if ( fireunit.chromeID( "fbContentBox" ).getAttribute("collapsed") !== "false" )
- fireunit.click( fireunit.chromeID( "fbStatusBar" ) );
- fireunit.focus( fireunit.chromeID( "fbCommandLine" ) );
-
- setTimeout(function(){
- // Verify basic command execution
- state = false;
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "state = true;" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- fireunit.ok( state, "Console command executed." );
- checkText( '<span class="objectBox objectBox-number">true</span>', "Command value verified" );
-
- clear();
- fireunit.ok( fireunit.panel("console").getElementsByTagName("div").length == 0, "Verify console clear" );
-
- // Check output
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "window" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<a class="objectLink objectLink-object">Window <span class="objectPropValue">commandline.html</span></a>', "Window value verified" );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "document" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( "<a class=\"objectLink objectLink-object\">Document <span class=\"objectPropValue\">commandline.html</span></a>", "Document value verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "a" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( "<span class=\"objectBox objectBox-string\">\"three\"</span>", "string value verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "b" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<span class="objectBox objectBox-text">&gt;&gt;&gt; b</span>', "undefined value verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "c" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<span class="objectBox objectBox-null">null</span>', "null value verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "d" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<span class="objectBox objectBox-number">2</span>', "number value verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "d = 999;" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<span class="objectBox objectBox-number">999</span>', "Assignment return value verified." );
- fireunit.ok( d == 999, "number set verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "d" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<span class="objectBox objectBox-number">999</span>', "number value verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "set_d_val" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<a class="objectLink objectLink-function">set_d_val(td)</a>', "function value verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "set_d_val(998);" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<span class="objectBox objectBox-number">998</span>', "function return value verified." );
- fireunit.ok( d == 998, "Verify the number change." );
-
- clear();
-
- // Errors
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "blah" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( ' <a class="objectLink objectLink-object"><span class="objectTitle">ReferenceError: blah is not defined</span> source=<span class="objectPropValue">blah</span></a><a class="objectLink objectLink-sourceLink">commandline.html (line \\d+)</a>', "Error verified." );
-
- clear();
-
- // Assignment
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "var blah = 'oink';" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<span class="objectBox objectBox-text">&gt;&gt;&gt; var blah = \'oink\';</span>', "Variable assignment verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "blah" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( "<span class=\"objectBox objectBox-string\">\"oink\"</span>", "string value verified." );
-
- clear();
-
- // DOM Elements
- fireunit.test("DOM Elements", function(){
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "document.getElementsByTagName('div')[0]" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<a class="objectLink objectLink-element">&lt;<span class="nodeTag">div</span>&gt;</a>', "DOM Element verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "document.getElementsByTagName('div')[1]" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<a class="objectLink objectLink-element">&lt;<span class="nodeTag">div</span>&nbsp;id="<span class="nodeValue">first</span>"&nbsp;classname="<span class="nodeValue">test</span>"&nbsp;style="<span class="nodeValue">color: red;</span>"&gt;</a>', "DOM Element verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "document.getElementsByTagName('div')[1]" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<a class="objectLink objectLink-element">&lt;<span class="nodeTag">div</span>&nbsp;id="<span class="nodeValue">first</span>"&nbsp;classname="<span class="nodeValue">test</span>"&nbsp;style="<span class="nodeValue">color: red;</span>"&gt;</a>', "DOM Element verified." );
-
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "document.getElementsByTagName('div')[2]" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- checkText( '<a class="objectLink objectLink-element">&lt;<span class="nodeTag">div</span>&nbsp;id="<span class="nodeValue">last</span>"&gt;</a>', "DOM Element verified." );
-
- clear();
- });
-
- // Trigger large console
- //fireunit.type( "fbCommandLine", "alert('test');\n" );
-
- fireunit.queue(function(){
- Application.prefs.setValue("extensions.firebug.throttleMessages", oldThrottle);
- });
- }, 500);
-};
-</script>
-
-</head>
-
-<body>
- <div></div>
- <div id="first" style='color:red;' className="test">===</div>
- <div id="last">---</div>
- <textarea id="text">test</textarea>
-</body>
-</html>
@@ -1,115 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
-<script src="chrome://firebug/content/xpcom.js"></script>
-<script src="chrome://firebug/content/lib.js"></script>
-<script src="chrome://firebug/content/chrome.js"></script>
-<script src="chrome://firebug/content/domplate.js"></script>
-<script>
-with(FBL){
-function runTest()
-{
- var people = [
- {firstName: 'Bob', lastName: 'Jones'},
- {firstName: 'Fred', lastName: 'Smith'},
- {firstName: 'Hugo', lastName: 'Britos'},
- {firstName: 'Bob', lastName: 'Jones'},
- {firstName: 'Fred', lastName: 'Smith'},
- {firstName: 'Hugo', lastName: 'Britos'},
- {firstName: 'Bob', lastName: 'Jones'},
- {firstName: 'Fred', lastName: 'Smith'},
- {firstName: 'Hugo', lastName: 'Britos'},
- {firstName: 'Bob', lastName: 'Jones'},
- {firstName: 'Fred', lastName: 'Smith'},
- {firstName: 'Hugo', lastName: 'Britos'},
- {firstName: 'Bob', lastName: 'Jones'},
- {firstName: 'Fred', lastName: 'Smith'},
- {firstName: 'Hugo', lastName: 'Britos'},
- {firstName: 'Bob', lastName: 'Jones'},
- {firstName: 'Fred', lastName: 'Smith'},
- {firstName: 'Hugo', lastName: 'Britos'},
- ];
-
- var args = {
- url: 'http://foo.com',
- place: 'world',
- greetingClass: 'greeting',
- peeps: people,
- clickIt: onClick,
- custom: CAPTION
- };
-
- var node = PEOPLE.replace(args, document.body);
- //PEOPLE.insertAfter(args, $("first"));
-
- //a4();
-
- fireunit.ok( document.body.innerHTML == '<div hello="world" class="blue">Heading<img class="twisty mytwisty foo"><span class="caption">(world)</span><span class="caption">(world)</span><a href="http://foo.com" class="greeting">Hello</a><div name="Bob" class="">I am Bob Jones of the world.</div><span class="">Roar.</span><div name="Fred" class="">I am Fred Smith of the world.</div><span class="">Roar.</span><div name="Hugo" class="">I am Hugo Britos of the world.</div><span class="">Roar.</span><div name="Bob" class="">I am Bob Jones of the world.</div><span class="">Roar.</span><div name="Fred" class="">I am Fred Smith of the world.</div><span class="">Roar.</span><div name="Hugo" class="">I am Hugo Britos of the world.</div><span class="">Roar.</span><div name="Bob" class="">I am Bob Jones of the world.</div><span class="">Roar.</span><div name="Fred" class="">I am Fred Smith of the world.</div><span class="">Roar.</span><div name="Hugo" class="">I am Hugo Britos of the world.</div><span class="">Roar.</span><div name="Bob" class="">I am Bob Jones of the world.</div><span class="">Roar.</span><div name="Fred" class="">I am Fred Smith of the world.</div><span class="">Roar.</span><div name="Hugo" class="">I am Hugo Britos of the world.</div><span class="">Roar.</span><div name="Bob" class="">I am Bob Jones of the world.</div><span class="">Roar.</span><div name="Fred" class="">I am Fred Smith of the world.</div><span class="">Roar.</span><div name="Hugo" class="">I am Hugo Britos of the world.</div><span class="">Roar.</span><div name="Bob" class="">I am Bob Jones of the world.</div><span class="">Roar.</span><div name="Fred" class="">I am Fred Smith of the world.</div><span class="">Roar.</span><div name="Hugo" class="">I am Hugo Britos of the world.</div><span class="">Roar.</span><p class="">Yeah world</p></div>',
- "Verify contents." );
-}
-
-function traceMe(xx, yy, zz)
-{
-
-}
-
-function onClick(event)
-{
- ddd("you just clicked", event.target)
-}
-
-function onHover(event)
-{
- event.currentTarget.style.color = "blue";
-}
-
-function onHoverOut(event)
-{
- event.currentTarget.style.color = "inherit";
-}
-
-function formatPlace(place)
-{
- return place + ".";
-}
-
-var TWISTY = IMG({"class": "twisty"});
-
-var CAPTION = SPAN({"class": "caption", _foo: "$text", onclick: function() { alert("click " + this); }}, "$text|formatCaption");
-
-var PEOPLE =
- DIV({'class': 'blue', hello: '$place', _home: '$place|formatPlace', onclick: "$clickIt"},
- "Heading",
- TWISTY({"class": "mytwisty", $foo: '$place'}),
- TAG("$custom", {text: "$place"}),
- TAG(CAPTION, {text: "$place"}),
- A({href: '$url', 'class': '$greetingClass'}, "Hello"),
- FOR('peep', '$peeps',
- DIV({name: '$peep.firstName', _myName: '$peep.firstName "The Dumbass" $peep.lastName',
- onmouseover: onHover, onmouseout: onHoverOut},
- 'I am $peep.firstName $peep.lastName of the $place\\.'
- ),
- SPAN("Roar.")
- ),
- P("Yeah $place")
- );
-
-window.addEventListener("load", runTest, false);
-
-function formatCaption(text)
-{
- return "(" + text + ")"
-}
-}
-</script>
-
-</head>
-
-<body>
- <div id="first">===</div>
- <div id="last">---</div>
-</body>
-</html>
@@ -1,40 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
-<script src="chrome://firebug/content/xpcom.js"></script>
-<script src="chrome://firebug/content/lib.js"></script>
-<script src="chrome://firebug/content/chrome.js"></script>
-<script src="chrome://firebug/content/domplate.js"></script>
-<script>
-var state = false;
-
-// URL Redirection
-// URL Reloading
-// Async tests
-
-fireunit.click( fireunit.chromeID( "fbStatusBar" ) );
-fireunit.focus( fireunit.chromeID( "fbCommandLine" ) );
-
-setTimeout(function(){
- // Verify basic command execution
- state = false;
- fireunit.value( fireunit.chromeID( "fbCommandLine" ), "state = true;" );
- fireunit.key( fireunit.chromeID( "fbCommandLine" ), 13 );
- fireunit.ok( state, "Console command executed." );
-
- // Trigger large console
- //fireunit.type( "fbCommandLine", "alert('test');\n" );
-}, 500);
-</script>
-
-</head>
-
-<body>
- <div id="first">===</div>
- <div id="last">---</div>
- <textarea id="text">test</textarea>
-</body>
-</html>

0 comments on commit c51e5a5

Please sign in to comment.