Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Tweaked some of the tests, added in events and fx tests.
  • Loading branch information
jeresig committed Jul 9, 2007
1 parent b09043f commit 5403520
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 13 deletions.
7 changes: 6 additions & 1 deletion build/runtest/test.js
Expand Up @@ -6,7 +6,12 @@ window.location = "test/index.html";
load("dist/jquery.js","build/runtest/testrunner.js");

// Load the tests
load("src/jquery/coreTest.js","src/selector/selectorTest.js");
load(
"src/jquery/coreTest.js",
"src/selector/selectorTest.js",
"src/event/eventTest.js",
"src/fx/fxTest.js"
);

// Display the results
results();
23 changes: 22 additions & 1 deletion build/runtest/testrunner.js
Expand Up @@ -160,4 +160,25 @@ function results(){
}

function start(){}
function stop(){}
function stop(){}

/**
* Trigger an event on an element.
*
* @example triggerEvent( document.body, "click" );
*
* @param DOMElement elem
* @param String type
*/
function triggerEvent( elem, type, event ) {
/*
if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
event = document.createEvent("MouseEvents");
event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
elem.dispatchEvent( event );
} else if ( jQuery.browser.msie ) {
elem.fireEvent("on"+type);
}
*/
}
15 changes: 5 additions & 10 deletions src/event/eventTest.js
Expand Up @@ -28,22 +28,17 @@ test("bind()", function() {


// events don't work with iframes, see #939
var tmp = document.createElement('iframe');
document.body.appendChild( tmp );
var doc = tmp.contentWindow.document;
doc.open();
doc.write("<html><body><input type='text'/></body></html>");
doc.close();
var doc = document.getElementById("iframe").contentDocument;

doc.body.innerHTML = "<input type='text'/>";

var input = doc.getElementsByTagName("input")[0];

$(input).bind("click",function() {
ok( true, "Binding to element inside iframe" );
});

triggerEvent( input, "click" );
}).click();

document.body.removeChild( tmp );
//triggerEvent( input, "click" );

var counter = 0;
function selectOnChange(event) {
Expand Down
2 changes: 1 addition & 1 deletion src/jquery/coreTest.js
Expand Up @@ -340,7 +340,7 @@ test("wrap(String|Element)", function() {
ok( result.text() == defaultText, 'Check for element wrapping' );

reset();
stop();
//stop();
$('#check1').click(function() {
var checkbox = this;
ok( checkbox.checked, "Checkbox's state is erased after wrap() action, see #769" );
Expand Down

0 comments on commit 5403520

Please sign in to comment.