Sha256: d65a664b8d7962e4de3d6d3ede8ad702005ba597834f06c1d07e1bf474ec1e70
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
describe "directives", -> beforeEach module("mb.directives") $scope = null element = null describe "osEsc", -> beforeEach inject ($compile, $rootScope) -> $scope = $rootScope.$new() $scope.bar = -> element = $compile('<input type="text" on-esc="bar()" />')($scope) $scope.$digest() it "calls the given function when the ESC was pressed", -> spyOn($scope, 'bar') event = jQuery.Event("keyup", keyCode: 27) element.trigger(event) expect($scope.bar).toHaveBeenCalled() it "does nothing on other keys", -> spyOn($scope, 'bar') event = jQuery.Event("keyup", keyCode: 13) element.trigger(event) expect($scope.bar).not.toHaveBeenCalled() describe "deleteButton", -> beforeEach inject ($compile, $rootScope) -> $scope = $rootScope.$new() $scope.bar = -> template = """ <div> <delete-button ng-click="bar()" /> </div> """ element = $compile(template)($scope) $scope.$digest() it "renders bar button", -> button = element.find("a") expect(button.length).toBe(1) expect(button.hasClass("btn")).toBeTruthy() expect(button.hasClass("btn-danger")).toBeTruthy() expect(button.text()).toContain("Delete") it "ng-click", -> spyOn($scope, 'bar') button = element.find("button") button.click() expect($scope.bar).not.toHaveBeenCalled()
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo_browser-0.2.0.rc2 | spec/javascripts/app/directives_spec.js.coffee |