Permalink
Browse files

before and after test suite hooks

  • Loading branch information...
Nick Kallen
Nick Kallen committed Apr 28, 2008
1 parent dfbfdb4 commit dbecda9cee5cc13f371fac712d995897aa7d5dad
Showing with 43 additions and 35 deletions.
  1. +4 −4 lib/jquery-1.2.3.js
  2. +4 −3 lib/screw.behaviors.js
  3. +1 −1 lib/screw.builder.js
  4. +34 −27 lib/screw.events.js
View
@@ -1857,7 +1857,7 @@ jQuery.event = {
var val;
// Handle the second event of a trigger and when
- // an event is called after a page has unloaded
+ // an event is called after a page has unload
if ( typeof jQuery == "undefined" || jQuery.event.triggered )
return val;
@@ -2282,7 +2282,7 @@ jQuery.extend({
readyList: [],
// Handle when the DOM is ready
ready: function() {
- // Make sure that the DOM is not already loaded
+ // Make sure that the DOM is not already load
if ( !jQuery.isReady ) {
// Remember that the DOM is ready
jQuery.isReady = true;
@@ -2347,7 +2347,7 @@ function bindReady(){
var numStyles;
(function(){
if (jQuery.isReady) return;
- if ( document.readyState != "loaded" && document.readyState != "complete" ) {
+ if ( document.readyState != "load" && document.readyState != "complete" ) {
setTimeout( arguments.callee, 0 );
return;
}
@@ -2641,7 +2641,7 @@ jQuery.extend({
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if ( !done && (!this.readyState ||
- this.readyState == "loaded" || this.readyState == "complete") ) {
+ this.readyState == "load" || this.readyState == "complete") ) {
done = true;
success();
complete();
View
@@ -1,4 +1,4 @@
-$(Screw).bind('loaded', function() {
+$(Screw).bind('load', function() {
$('.status').fn({
display: function() {
$(this).text(
@@ -32,6 +32,7 @@ $(Screw).bind('loaded', function() {
},
run: function() {
try {
+ // TESTME
$(this)
.fn('parent').fn('run_befores');
$(this).data('screwunit.run')();
@@ -58,10 +59,10 @@ $(Screw).bind('loaded', function() {
run: function() { $(this).data('screwunit.run')() }
});
- $('.status').text('Running...');
+ $(Screw).trigger('before');
var to_run = unescape(location.search.slice(1)) || 'body > .describes > .describe';
$(to_run)
.focus()
.fn('enqueue');
- $(Screw).queue(function() { $('.status').fn('display') });
+ $(Screw).queue(function() { $(Screw).trigger('after') });
});
View
@@ -12,7 +12,7 @@ var Screw = {
.append($('<ul class="describes">'))
);
fn.call(this, Screw.Matchers, Screw.Specifications);
- $(Screw).trigger('loaded');
+ $(Screw).trigger('load');
});
},
Specifications: {
View
@@ -1,28 +1,35 @@
-$(Screw).bind('loaded', function() {
- $('.describe, .it')
- .click(function() {
- document.location = location.href.split('?')[0] + '?' + $(this).fn('selector');
- return false;
- })
- .focus(function() {
- $('body').get(0).scrollTop = $(this).offset().top;
- return $(this).addClass('focused');
- });
+$(Screw)
+ .bind('load', function() {
+ $('.describe, .it')
+ .click(function() {
+ document.location = location.href.split('?')[0] + '?' + $(this).fn('selector');
+ return false;
+ })
+ .focus(function() {
+ $('body').get(0).scrollTop = $(this).offset().top;
+ return $(this).addClass('focused');
+ });
- $('.it')
- .bind('enqueued', function() {
- $(this).addClass('enqueued');
- })
- .bind('running', function() {
- $(this).addClass('running');
- })
- .bind('passed', function() {
- $(this).addClass('passed');
- })
- .bind('failed', function(e, reason) {
- $(this).addClass('failed');
- $('<p class="error">')
- .text(reason.toString())
- .appendTo($(this));
- })
-});
+ $('.it')
+ .bind('enqueued', function() {
+ $(this).addClass('enqueued');
+ })
+ .bind('running', function() {
+ $(this).addClass('running');
+ })
+ .bind('passed', function() {
+ $(this).addClass('passed');
+ })
+ .bind('failed', function(e, reason) {
+ $(this).addClass('failed');
+ $('<p class="error">')
+ .text(reason.toString())
+ .appendTo($(this));
+ })
+ })
+ .bind('before', function() {
+ $('.status').text('Running...');
+ })
+ .bind('after', function() {
+ $('.status').fn('display')
+ })

0 comments on commit dbecda9

Please sign in to comment.