1
0
mirror of synced 2024-11-22 21:16:10 +03:00
select2/tests/helpers.js
Kevin Brown a0c26e1114 Hook up with SauceLabs
This sets up Select2 to be able to run tests on the SauceLabs
environment. This will allow us to run the tests on different
browsers in the future, though at the moment we need to start
combining test files.

This required adding a snippet of code for reporting QUnit test
results to SauceLabs within the global test helper file.

The tests currently cannot be run on IE 8 because all of the tests
are using jQuery 2.x, which is not compatible.
2015-02-13 21:59:09 -05:00

47 lines
1001 B
JavaScript

// Restore the require/define
var require = $.fn.select2.amd.require;
var define = $.fn.select2.amd.define;
// Disable jQuery's binding to $
jQuery.noConflict();
var Utils = require('select2/utils');
function MockContainer () {
MockContainer.__super__.constructor.call(this);
}
Utils.Extend(MockContainer, Utils.Observable);
MockContainer.prototype.isOpen = function () {
return this.isOpen;
};
var log = [];
var testName;
QUnit.done(function (test_results) {
var tests = [];
for(var i = 0, len = log.length; i < len; i++) {
var details = log[i];
tests.push({
name: details.name,
result: details.result,
expected: details.expected,
actual: details.actual,
source: details.source
});
}
test_results.tests = tests;
window.global_test_results = test_results;
});
QUnit.testStart(function(testDetails){
QUnit.log(function(details){
if (!details.result) {
details.name = testDetails.name;
log.push(details);
}
});
});