Skip to content

Commit

Permalink
added div.screw_unit_content to suite.html and selectors to minimize …
Browse files Browse the repository at this point in the history
…conflicts with application css/js.
  • Loading branch information
Jeff Whitmire & Corey Innis committed Nov 19, 2008
1 parent 337dce3 commit 83a5a7b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
18 changes: 9 additions & 9 deletions lib/screw.behaviors.js
@@ -1,15 +1,15 @@
(function($) {
$(Screw).bind('loaded', function() {
$('.status').fn({
$('body > div.screw_unit_content .status').fn({
display: function() {
$(this).html(
$('.passed').length + $('.failed').length + ' test(s), ' + $('.failed').length + ' failure(s)<br />' +
$('.screw_unit_content .passed').length + $('.screw_unit_content .failed').length + ' test(s), ' + $('.screw_unit_content .failed').length + ' failure(s)<br />' +
((new Date() - Screw.suite_start_time)/1000.0).toString() + " seconds elapsed"
);
}
});

$('.describe').fn({
$('body > div.screw_unit_content .describe').fn({
parent: function() {
return $(this).parent('.describes').parent('.describe');
},
Expand All @@ -35,11 +35,11 @@
}
});

$('body > .describe').fn({
selector: function() { return 'body > .describe' }
$('body > div.screw_unit_content > .describe').fn({
selector: function() { return 'body > div.screw_unit_content > .describe' }
});

$('.it').fn({
$('body > div.screw_unit_content .it').fn({
parent: function() {
return $(this).parent('.its').parent('.describe');
},
Expand Down Expand Up @@ -73,16 +73,16 @@
}
});

$('.before').fn({
$('body > div.screw_unit_content .before').fn({
run: function() { $(this).data('screwunit.run')() }
});

$('.after').fn({
$('body > div.screw_unit_content .after').fn({
run: function() { $(this).data('screwunit.run')() }
});

$(Screw).trigger('before');
var to_run = unescape(location.search.slice(1)) || 'body > .describe > .describes > .describe';
var to_run = unescape(location.search.slice(1)) || 'body > div.screw_unit_content > .describe > .describes > .describe';
$(to_run)
.focus()
.eq(0).trigger('scroll').end()
Expand Down
4 changes: 2 additions & 2 deletions lib/screw.builder.js
Expand Up @@ -7,7 +7,7 @@ var Screw = (function($) {
);

$(Screw).queue(function() {
Screw.Specifications.context.push($('body > .describe'));
Screw.Specifications.context.push($('body > div.screw_unit_content > .describe'));
fn.call(this, Screw.Matchers, Screw.Specifications);
Screw.Specifications.context.pop();
$(this).dequeue();
Expand Down Expand Up @@ -71,7 +71,7 @@ var Screw = (function($) {
.append('<ol class="befores">')
.append('<ul class="describes">')
.append('<ol class="afters">')
.appendTo('body');
.appendTo('body > div.screw_unit_content');

$(screw).dequeue();
$(screw).trigger('loaded');
Expand Down
8 changes: 4 additions & 4 deletions lib/screw.events.js
@@ -1,7 +1,7 @@
(function($) {
$(Screw)
.bind('loaded', function() {
$('.describe, .it')
$('body > div.screw_unit_content .describe, body > div.screw_unit_content .it')
.click(function() {
document.location = location.href.split('?')[0] + '?' + $(this).fn('selector');
return false;
Expand All @@ -13,7 +13,7 @@
document.body.scrollTop = $(this).offset().top;
});

$('.it')
$('body > div.screw_unit_content .it')
.bind('enqueued', function() {
$(this).addClass('enqueued');
})
Expand All @@ -37,9 +37,9 @@
})
.bind('before', function() {
Screw.suite_start_time = new Date();
$('.status').text('Running...');
$('body > div.screw_unit_content .status').text('Running...');
})
.bind('after', function() {
$('.status').fn('display')
$('body > div.screw_unit_content .status').fn('display')
})
})(jQuery);
4 changes: 3 additions & 1 deletion spec/suite.html
Expand Up @@ -14,5 +14,7 @@

<link rel="stylesheet" href="../lib/screw.css">
</head>
<body></body>
<body>
<div class="screw_unit_content"></div>
</body>
</html>

0 comments on commit 83a5a7b

Please sign in to comment.