helpers.js 1001 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Restore the require/define
  2. var require = $.fn.select2.amd.require;
  3. var define = $.fn.select2.amd.define;
  4. // Disable jQuery's binding to $
  5. jQuery.noConflict();
  6. var Utils = require('select2/utils');
  7. function MockContainer () {
  8. MockContainer.__super__.constructor.call(this);
  9. }
  10. Utils.Extend(MockContainer, Utils.Observable);
  11. MockContainer.prototype.isOpen = function () {
  12. return this.isOpen;
  13. };
  14. var log = [];
  15. var testName;
  16. QUnit.done(function (test_results) {
  17. var tests = [];
  18. for(var i = 0, len = log.length; i < len; i++) {
  19. var details = log[i];
  20. tests.push({
  21. name: details.name,
  22. result: details.result,
  23. expected: details.expected,
  24. actual: details.actual,
  25. source: details.source
  26. });
  27. }
  28. test_results.tests = tests;
  29. window.global_test_results = test_results;
  30. });
  31. QUnit.testStart(function(testDetails){
  32. QUnit.log(function(details){
  33. if (!details.result) {
  34. details.name = testDetails.name;
  35. log.push(details);
  36. }
  37. });
  38. });