Permalink
Browse files

NEW Test support for context in makeSlickTestSearch and it_should_find

  • Loading branch information...
1 parent 805427c commit 8db35a6713ae01ea74d29b3651c484c2fdae5d47 @subtleGradient subtleGradient committed Mar 26, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 SlickSpec/specs/mock_template.js
@@ -1,10 +1,10 @@
var specsMockTemplate = function(context){
- var makeSlickTestSearch = function(selector, count, disableQSA) {
+ var makeSlickTestSearch = function(selector, count, disableQSA, subContext) {
return function(){
context.SELECTOR.disableQSA = !!disableQSA;
- var selectedArray = context.SELECT(context.document, selector);
- var selected = context.SELECT1(context.document, selector);
+ var selectedArray = context.SELECT(subContext || context.document, selector);
+ var selected = context.SELECT1(subContext || context.document, selector);
expect( selectedArray.length ).toEqual( count );
if (count){
expect( selected ).not.toBeNull();
@@ -17,10 +17,10 @@ var specsMockTemplate = function(context){
};
};
- var it_should_find = function(count, selector){
+ var it_should_find = function(count, selector, subContext){
if (global.document.querySelectorAll && !global.cannotDisableQSA)
- it('should find '+count+' `'+selector+'` with QSA', makeSlickTestSearch(selector, count, false));
- it('should find '+count+' `'+selector + (!global.cannotDisableQSA ? '` without QSA' : ''), makeSlickTestSearch(selector, count, true));
+ it('should find '+count+' `'+selector+'` with QSA', makeSlickTestSearch(selector, count, false, subContext));
+ it('should find '+count+' `'+selector + (!global.cannotDisableQSA ? '` without QSA' : ''), makeSlickTestSearch(selector, count, true, subContext));
};
it_should_find(1, 'html');

0 comments on commit 8db35a6

Please sign in to comment.