Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.

Commit 335001d

Browse files
committed
Merge pull request #106 from jakemmarsh/fix-directive
Fix directive
2 parents 89e1d70 + 4994907 commit 335001d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

app/js/directives/example.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ function ExampleDirective() {
99
title: '@',
1010
message: '@exampleDirective'
1111
},
12-
link: (scope, element, attrs) => {
12+
link: (scope, element) => {
1313
element.on('click', () => {
14-
alert('Element clicked: ' + scope.message);
14+
window.alert('Element clicked: ' + scope.message);
1515
});
1616
}
1717
};

test/unit/directives/example_spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ describe('Unit: ExampleDirective', function() {
1313
angular.mock.inject(function($compile, $rootScope) {
1414
scope = $rootScope;
1515
element = angular.element('<div example-directive="{{message}}" title="{{title}}">Sample Directive</div>');
16-
scope.title = "A sample title";
17-
scope.message = "It doesn't hurt.";
16+
scope.title = 'A sample title';
17+
scope.message = 'It doesn\'t hurt.';
1818
$compile(element)(scope);
1919
scope.$digest();
2020
});
2121
});
2222

2323
it('should bind itself to the element', function() {
2424
element.triggerHandler('click');
25-
expect(window.alert).toHaveBeenCalledWith("Element clicked: It doesn't hurt.");
25+
expect(window.alert).toHaveBeenCalledWith('Element clicked: It doesn\'t hurt.');
2626
});
2727

2828
it('should update its bindings', function() {
29-
scope.message = "It hurts a bit.";
29+
scope.message = 'It hurts a bit.';
3030
scope.$digest();
3131
element.triggerHandler('click');
32-
expect(window.alert).toHaveBeenCalledWith("Element clicked: It hurts a bit.");
32+
expect(window.alert).toHaveBeenCalledWith('Element clicked: It hurts a bit.');
3333
});
3434

3535
it('should bind a title property to its template', function() {

0 commit comments

Comments
 (0)