Skip to content
Browse files

Cleaned up subtests and removed search_tabs directory, which was not …

…being used.
  • Loading branch information...
1 parent 7a56aa4 commit e046bda6e7c37be06c78f8803a3ac86fce62f450 jeremyckahn committed Oct 16, 2010
2 documentjs
@@ -1 +1 @@
-Subproject commit 2796274862526040197e4352011f95fbce3e3013
+Subproject commit bfa20dd2a88db4653c279accbf7f4ece1295e5f0
2 funcunit
@@ -1 +1 @@
-Subproject commit 469366136756d0352c4fc285c604bbc1057e316b
+Subproject commit e8c413e57dda85da7eca2d0c47843c5308175855
2 jquery
@@ -1 +1 @@
-Subproject commit a52a7a8e533a377e82c6efe636b6ac122e94abfd
+Subproject commit 7c69de18a97534bf665b905b3acdecc8a1d8c164
View
0 js 100755 → 100644
File mode changed.
View
59 js.bat
@@ -0,0 +1,59 @@
+:: This script checks for arguments, if they don't exist it opens the Rhino dialog
+:: if arguments do exist, it loads the script in the first argument and passes the other arguments to the script
+:: ie: js jmvc\script\controller Todo
+@echo off
+SETLOCAL ENABLEDELAYEDEXPANSION
+if "%1"=="" (
+ java -cp steal\rhino\js.jar org.mozilla.javascript.tools.shell.Main
+ GOTO END
+)
+if "%1"=="-h" GOTO PRINT_HELP
+if "%1"=="-?" GOTO PRINT_HELP
+if "%1"=="--help" GOTO PRINT_HELP
+
+if "%1"=="-d" (
+ java -classpath funcunit/java/selenium-java-client-driver.jar;steal/rhino/js.jar org.mozilla.javascript.tools.debugger.Main
+ GOTO END
+)
+if "%1"=="-selenium" (
+ java -jar funcunit\java\selenium-server.jar
+ GOTO END
+)
+SET CP=funcunit/java/selenium-java-client-driver.jar;steal\rhino\js.jar
+if "%1"=="-mail" (
+ SET CP=steal/rhino/mail.jar;funcunit/java/selenium-java-client-driver.jar;steal\rhino\js.jar
+ SHIFT /0
+)
+SET ARGS=[
+SET FILENAME=%1
+SET FILENAME=%FILENAME:\=/%
+::haven't seen any way to loop through all args yet, so for now this goes through arg 2-7
+for /f "tokens=2,3,4,5,6,7 delims= " %%a in ("%*") do SET ARGS=!ARGS!'%%a','%%b','%%c','%%d','%%e','%%f'
+::remove the empty args
+:: for %%a in (",''=") do ( call set ARGS=%%ARGS:%%~a%% )
+SET ARGS=%ARGS:,''=%
+::remove the spaces
+:: for /f "tokens=1*" %%A in ("%ARGS%") do SET ARGS=%%A
+SET ARGS=%ARGS: =%
+SET ARGS=%ARGS%]
+set ARGS=%ARGS:\=/%
+java -Xmx170m -Xss1024k -cp %CP% org.mozilla.javascript.tools.shell.Main -opt -1 -e _args=%ARGS% -e load('%FILENAME%')
+
+GOTO END
+
+:PRINT_HELP
+echo Load a command line Rhino JavaScript environment or run JavaScript script files in Rhino.
+echo Available commands:
+echo js Opens a command line JavaScript environment
+echo js -d Opens the Rhino debugger
+echo js -selenium Starts selenium server
+echo js [FILE] Runs FILE in the Rhino environment
+
+echo JavaScriptMVC script usage:
+echo js steal/generate/app [NAME] Creates a new JavaScriptMVC application
+echo js steal/generate/page [APP] [PAGE] Generates a page for the application
+echo js steal/generate/controller [NAME] Generates a Controller file
+echo js steal/generate/model [TYPE] [NAME] Generates a Model file
+echo js apps/[NAME]/compress.js Compress your application and generate documentation
+
+:END
View
34 srchr/history/funcunit/history_test.js
@@ -1,51 +1,43 @@
module("srchr/history",{
setup : function(){
- S.open('//srchr/history/history.html')
+ S.open('//srchr/history/history.html');
}
});
test("Add and remove history", function(){
S("#searchText").type("hello world\r", function(){
-
equals( S(".search:contains('hello world')").size(), 1 , "there is one hello world" );
});
- S(".search:contains('hello world')").find(".remove").click()
+ S(".search:contains('hello world')").find(".remove").click();
S(".search:contains('hello world')").size(0, function(){
- ok("no more world")
+ ok('no more "hello world"');
});
-
});
-test("add and refresh", function(){
+test("Add and refresh", function(){
S("#searchText").type("hello world\r", function(){
-
equals( S(".search:contains('hello world')").size(), 1 , "there is one hello world" );
-
});
- S(".search:contains('hello world')").find(".remove").click()
-})
+ S(".search:contains('hello world')").find(".remove").click();
+});
-test("populate search", function(){
+test("Populate search", function(){
+
S("#searchText").type("hello world\r", function(){
-
equals( S(".search:contains('hello world')").size(), 1 , "there is one hello world" );
-
- })
- //.type("[ctrl]a[ctrl-up]\b");
- .type("\b\b\b\b\b\b\b\b\b\b\b\b\b")
+ });
- S('.search').visible()
+ S('.search').visible();
- S(".search").click( function(){
- equals( S("#searchText").val(), "hello world" , "hello world is set again" );
-
+ S(".search:contains('hello world')").click( function(){
+ equals( S("#searchText").val(), "hello world" , "hello world is set again" );
});
-})
+});
View
46 srchr/search/funcunit/search_test.js
@@ -1,75 +1,69 @@
module("srchr/search",{
setup : function(){
- S.open('//srchr/search/search.html')
+ S.open('//srchr/search/search.html');
}
});
function search(query){
- S('input[name=query]').type(query+"\r")
+ S('input[name=query]').type(query+"\r");
}
// This wait is needed because IE is slow to clear out the textbox when clicked
function clearout(){
- S('input[name=query]').click()
- S('input[name=query]').val(new String())
+ S('input[name=query]').click();
+ S('input[name=query]').val(new String());
}
-
test("Empty the search field and blur it", function(){
S('input[name=query]').click(function(){
- ok(!S('input[name=query]').val().length, 'Text field is empty!')
- })
+
+ ok(!S('input[name=query]').val().length, 'Text field is empty!');
+ });
S('html').click( function(){
-
ok(S('input[name=query]').val(), 'Text field is filled!')
ok(S('input[name=query]').hasClass('blurred'), 'Clicked query box is grayed out')
- })
+ });
});
test("Selected search box is not blurred and is empty", function(){
-
S('input[name=query]').click({}, function(){
- ok(!S('input[name=query]').hasClass('blurred'), 'Clicked query box is not grayed out')
+
+ ok(!S('input[name=query]').hasClass('blurred'), 'Clicked query box is not grayed out');
})
});
test("Submit form with no query and no type", function(){
+ S('input[type=submit]').click({}, function(){
- S('input[type=submit]').click()
-
- S.wait(20, function(){
ok(!S('#results').text(), "A search was not submitted: no query and no type")
})
});
test("Submit form with a query but no type", function(){
- clearout()
+ clearout();
S('input[name=query]').type('hello world')
- S('input[type=submit]').click()
-
- S.wait(20, function(){
+ S('input[type=submit]').click({}, function(){
ok(!S('#results').text(), "A search was not submitted: valid query, no type")
})
+
});
test("Submit form with a valid query and type", function(){
- clearout()
+ clearout();
S('input[name=query]').type('testing...', function(){
S('input[type=checkbox]:eq(0)').click({}, function(){
- S('input[type=submit]').click()
-
- S.wait(100, function(){
- ok(S('#results').text(), "A search was submitted, valid query and type")
- })
- })
- })
+ S('input[type=submit]').click({}, function(){
+ ok(S('#results').text(), "A search was submitted, valid query and type");
+ });
+ });
+ });
});
View
31 srchr/search_result/funcunit/search_result_test.js
@@ -2,34 +2,35 @@ module("srchr/search_result",{
setup : function(){
S.open('//srchr/search_result/search_result.html')
}
-})
+});
test("results shown", function(){
S("#searchVal").type("search\r");
S("li").exists(function(){
- ok(true, "results have been shown")
- })
-})
+
+ ok(true, "results have been shown");
+ });
+});
test("results not shown when hidden", function(){
S("#toggle").click();
- S("#searchVal").type("search\r");
- S.wait(20, function(){
- equals(S('li').size(), 0, "there are no li's")
+ S("#searchVal").type("search\r", function(){
+
+ equals(S('li').size(), 0, "there are no li's");
});
});
test("don't query when hidden", function(){
S("#searchVal").type("search\r");
S("li").exists(function(){
- ok(true, "results have been shown")
- })
+
+ ok(true, "results have been shown");
+ });
+
S("#toggle").click();
- S("#searchVal").type("\r");
- S.wait(20, function(){
- equals(S('#searchNum').text(), "1", "only 1 query")
-
- })
+ S("#searchVal").type("\r", function(){
-})
+ equals(S('#searchNum').text(), "1", "only 1 query");
+ });
+});
View
15 srchr/search_tabs/funcunit.html
@@ -1,15 +0,0 @@
-<html>
- <head>
- <link rel="stylesheet" type="text/css" href="../../funcunit/qunit/qunit.css" />
- <title>srchr FuncUnit Test</title>
- <script type='text/javascript' src='../../steal/steal.js?srchr/search_tabs/funcunit'></script>
- </head>
- <body>
-
- <h1 id="qunit-header">srchr Test Suite</h1>
- <h2 id="qunit-banner"></h2>
- <div id="qunit-testrunner-toolbar"></div>
- <h2 id="qunit-userAgent"></h2>
- <ol id="qunit-tests"></ol>
- </body>
-</html>
View
2 srchr/search_tabs/funcunit/funcunit.js
@@ -1,2 +0,0 @@
-steal
- .plugins("funcunit").then('search_tabs_test')
View
10 srchr/search_tabs/funcunit/search_tabs_test.js
@@ -1,10 +0,0 @@
-module("srchr/search_result",{
- setup : function(){
- S.open('//srchr/search_tabs/search_tabs.html')
- }
-})
-
-test('Are tabs generated?', function(){
- ok(S('a').size(), 'Tabs exist.')
- ok(S('div').size(), 'Content areas exist.')
-})
View
1 srchr/search_tabs/modelLoader.js
@@ -1 +0,0 @@
-steal.models('../../models/flickr.js','../../models/yahoo.js','../../models/upcoming.js')
View
26 srchr/search_tabs/search_tabs.html
@@ -1,26 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html lang="en">
- <head>
- <title>tabs</title>
- </head>
- <body>
-
- <ul id='resultsTab'></ul>
-
- <script type='text/javascript'
- src='../../steal/steal.js?srchr/search_tabs/modelLoader.js'>
- </script>
-
- <script type='text/javascript'
- src='../../steal/steal.js?srchr/search_tabs'>
- </script>
-
- <script type='text/javascript' >
-
- $('#resultsTab').search_tabs(Srchr.Models);
-
- </script>
-
- </body>
-</html>
View
62 srchr/search_tabs/search_tabs.js
@@ -1,62 +0,0 @@
-steal.plugins(
- '//srchr/tabs',
- '//srchr/disabler')
-
- .then(function($){
-
- /**
- * This plugin generates tabs HTML that is compliant with the Srchr Tabs controller.
- * It accepts the Srchr.Models object and dynamically creates the tabs HTML inside of the
- * UL that it was called on. It also creates the content areas that the tabs will operate
- * on. Finally, it calls srchr_tabs() and srchr_disabler() to return tabs that are ready
- * for use by other areas of the application.
- *
- * @codestart
-&lt;ul id='resultTabs'&gt;&lt;/ul&gt;
- @codeend
- *
- * @codestart
-$("#resultTabs").search_tabs(Srchr.Models);
- * @codeend
- *
- * All this plugin needs to work is HTML and JS as above. Individual tabs are created for each model except for "Search," since it is the superclass.
- *
- * @return jQuery
- * @tag plugins, home
- */
-
- $.fn.srchr_search_tabs = function(models) {
-
- var model, modelsArr = [], lastModel;
-
- for (model in models){
-
- // Don't include the parent "Search" class
- if (model !== 'Search'){
- modelsArr.push(model);
- }
- }
-
- // Go through each model in the array and make a tab for it, then append it to 'this'
- for (var i = 0; i < modelsArr.length; i++){
- this.append($('<li>')
- .html(
- $('<a>',{
- href : '#' + modelsArr[i]
- })
- .html(modelsArr[i])
- )
- );
- }
-
- // Create the content containers for each respective tab.
- // Looping through again so that the tabs' content divs show up in the same order as the tabs.
- // Note: Added an extra set of parens in the conditional to make JSLint happy.
- while ((lastModel = modelsArr.pop())){
- this.after($('<div>', { id : lastModel }));
- }
-
- return this.srchr_tabs().srchr_disabler();
- };
-
-});
View
27 srchr/tabs/funcunit/tabs_test.js
@@ -1,27 +1,26 @@
module("srchr/search_result",{
setup : function(){
- S.open('//srchr/tabs/tabs.html')
+ S.open('//srchr/tabs/tabs.html');
}
-})
+});
test("Proper hiding and showing", function(){
S("li:eq(1)").click();
S("div:eq(1)").visible(function(){
- equals(S("div:eq(0)").css('display'), 'none', "Old tab contents are hidden")
- ok(!S("li:eq(0)").hasClass('active'), 'Old tab is not set to active')
- equals(S("div:eq(1)").css('display'), 'block', "New tab contents are visible")
- ok(S("li:eq(1)").hasClass('active'), 'New tab is set to active')
- })
-})
+ equals(S("div:eq(0)").css('display'), 'none', "Old tab contents are hidden");
+ ok(!S("li:eq(0)").hasClass('active'), 'Old tab is not set to active');
+ equals(S("div:eq(1)").css('display'), 'block', "New tab contents are visible");
+ ok(S("li:eq(1)").hasClass('active'), 'New tab is set to active');
+ });
+});
-test("Clicking twice has doesn't break anything", function(){
+test("Clicking twice doesn't break anything", function(){
S("li:eq(2)").click();
- S.wait(1000)
S("li:eq(2)").click();
S("div:eq(2)").visible(function(){
- equals(S("div:eq(2)").css('display'), 'block', "New tab contents are visible")
- ok(S("li:eq(2)").hasClass('active'), 'New tab is set to active')
- })
-})
+ equals(S("div:eq(2)").css('display'), 'block', "New tab contents are visible");
+ ok(S("li:eq(2)").hasClass('active'), 'New tab is set to active');
+ });
+});
2 steal
@@ -1 +1 @@
-Subproject commit 9c8c5937983e0e4fead524fbf13488a3a9f343ee
+Subproject commit 5e04d3d13b3afaf7282b9956f1a7439400f78e1f

0 comments on commit e046bda

Please sign in to comment.
Something went wrong with that request. Please try again.