Sha256: 82ae3607b67fa55ed859d0a6d1200f145fdc4e8c38a3189d0596e8c6e1978502

Contents?: true

Size: 1.61 KB

Versions: 8

Compression:

Stored size: 1.61 KB

Contents

// jasmine matcher for expecting an element to have a css class
// https://github.com/angular/angular.js/blob/master/test/matchers.js
beforeEach(function() {
  jasmine.addMatchers({
    toHaveClass: function(util, customEqualityTesters) {
      return {
        compare: function(actual, expected) {
          var result = {
            pass: actual.hasClass(expected)
          };

          if (result.pass) {
            result.message = 'Expected "' + actual + '" not to have the "' + expected + '" class.';
          } else {
            result.message = 'Expected "' + actual + '" to have the "' + expected + '" class.';
          }

          return result;
        }
      }
    },
    toBeHidden: function(util, customEqualityTesters) {
      return {
        compare: function(actual) {
          var result = {
            pass: actual.hasClass('ng-hide') || actual.css('display') === 'none'
          };

          if (result.pass) {
            result.message = 'Expected "' + actual + '" not to be hidden';
          } else {
            result.message = 'Expected "' + actual + '" to be hidden';
          }

          return result;
        }
      }
    },
    toHaveFocus: function(util, customEqualityTesters) {
      return {
        compare: function(actual) {
          var result = {
            pass: document.activeElement === actual[0]
          };

          if (result.pass) {
            result.message = 'Expected "' + actual + '" not to have focus';
          } else {
            result.message = 'Expected "' + actual + '" to have focus';
          }

          return result;
        }
      }
    }
  });
});

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/angular-ui-bootstrap/misc/test-lib/helpers.js