Skip to content

Commit

Permalink
only run non-qSA tests in non-qSA environment
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jan 14, 2012
1 parent 08636b3 commit 403a3dc
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions tests/tests.js
@@ -1,17 +1,16 @@

// custom pseudo just for tests
// silly custom pseudo just for tests
Q.pseudos.humanoid = function(e, v) { return Q.is(e, 'li:contains(human)') || Q.is(e, 'ol:contains(human)') }

function sinkSuite(label, suite) {
sink(label + ' [qSA]', function () {
Q.configure({ 'NATIVE_QSA': true })
suite.apply(null, arguments)
})
sink(label + ' [non-QSA]', function () {
Q.configure({ 'NATIVE_QSA': false })
suite.apply(null, arguments)
})
}
var hasQSA = !!document.querySelectorAll
, sinkSuite = function (label, suite) {
sink(label + (hasQSA ? ' [qSA]' : ''), function () {
hasQSA && Q.configure({ 'NATIVE_QSA': true })
suite.apply(null, arguments)
})
hasQSA && sink(label + ' [non-QSA]', function () {
Q.configure({ 'NATIVE_QSA': false })
suite.apply(null, arguments)
})
}

sinkSuite('Contexts', function (test, ok) {

Expand Down

0 comments on commit 403a3dc

Please sign in to comment.