Sha256: 9fdee76d29d36d4948799a619ce7889fbe5042e67aca6ade3e57cef976420236
Contents?: true
Size: 1.15 KB
Versions: 36
Compression:
Stored size: 1.15 KB
Contents
describe('Directive: disableLink', function () { var element, $compile, $rootScope, compileDirective; compileDirective = function () { var html = '<a ng-click="blah()" ui-sref="blah" disable-link="item.disabled">Click Me</a>'; element = angular.element(html); $rootScope.item = {}; element = $compile(element)($rootScope); $rootScope.$digest(); }; beforeEach(module('Bastion.utils')); beforeEach(inject(function (_$compile_, _$rootScope_) { $compile = _$compile_; $rootScope = _$rootScope_.$new(); compileDirective(); })); describe("stops the link from being followed", function () { beforeEach(function () { compileDirective(); $rootScope.item.disabled = true; $rootScope.$digest(); }); it("by preventing the click event", function () { var event = { type: 'click', preventDefault: function () {} }; spyOn(event, 'preventDefault'); element.trigger(event); expect(event.preventDefault).toHaveBeenCalled(); }); }); });
Version data entries
36 entries across 36 versions & 1 rubygems