Skip to content

Commit

Permalink
Cleaned up subtests and removed search_tabs directory, which was not …
Browse files Browse the repository at this point in the history
…being used.
  • Loading branch information
jeremyckahn committed Oct 16, 2010
1 parent 7a56aa4 commit e046bda
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 196 deletions.
2 changes: 1 addition & 1 deletion documentjs
2 changes: 1 addition & 1 deletion funcunit
2 changes: 1 addition & 1 deletion jquery
Empty file modified js
100755 → 100644
Empty file.
59 changes: 59 additions & 0 deletions js.bat
Original file line number Diff line number Diff line change
@@ -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
34 changes: 13 additions & 21 deletions srchr/history/funcunit/history_test.js
Original file line number Diff line number Diff line change
@@ -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" );
});
})
});
46 changes: 20 additions & 26 deletions srchr/search/funcunit/search_test.js
Original file line number Diff line number Diff line change
@@ -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");
});
});
});

});
31 changes: 16 additions & 15 deletions srchr/search_result/funcunit/search_result_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
});

15 changes: 0 additions & 15 deletions srchr/search_tabs/funcunit.html

This file was deleted.

2 changes: 0 additions & 2 deletions srchr/search_tabs/funcunit/funcunit.js

This file was deleted.

10 changes: 0 additions & 10 deletions srchr/search_tabs/funcunit/search_tabs_test.js

This file was deleted.

1 change: 0 additions & 1 deletion srchr/search_tabs/modelLoader.js

This file was deleted.

26 changes: 0 additions & 26 deletions srchr/search_tabs/search_tabs.html

This file was deleted.

Loading

0 comments on commit e046bda

Please sign in to comment.