Commit 026ba3d6 authored by Robert Knight's avatar Robert Knight

Enable dot-notation ESLint rule

Use `.delete` instead of `['delete']` etc. since all browsers we target
support ES5.
parent af70a62b
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"array-callback-return": "error", "array-callback-return": "error",
"block-scoped-var": "error", "block-scoped-var": "error",
"curly": "error", "curly": "error",
"dot-notation": "error",
"eqeqeq": "error", "eqeqeq": "error",
"no-console": [ "no-console": [
"error", "error",
......
...@@ -143,7 +143,7 @@ function AnnotationController( ...@@ -143,7 +143,7 @@ function AnnotationController(
vm.annotation.user = vm.annotation.user || session.state.userid; vm.annotation.user = vm.annotation.user || session.state.userid;
vm.annotation.group = vm.annotation.group || groups.focused().id; vm.annotation.group = vm.annotation.group || groups.focused().id;
if (!vm.annotation.permissions) { if (!vm.annotation.permissions) {
vm.annotation.permissions = permissions['default'](vm.annotation.group); vm.annotation.permissions = permissions.default(vm.annotation.group);
} }
vm.annotation.text = vm.annotation.text || ''; vm.annotation.text = vm.annotation.text || '';
if (!Array.isArray(vm.annotation.tags)) { if (!Array.isArray(vm.annotation.tags)) {
...@@ -236,7 +236,7 @@ function AnnotationController( ...@@ -236,7 +236,7 @@ function AnnotationController(
* @name annotation.AnnotationController#delete * @name annotation.AnnotationController#delete
* @description Deletes the annotation. * @description Deletes the annotation.
*/ */
vm['delete'] = function() { vm.delete = function() {
return $timeout(function() { // Don't use confirm inside the digest cycle. return $timeout(function() { // Don't use confirm inside the digest cycle.
var msg = 'Are you sure you want to delete this annotation?'; var msg = 'Are you sure you want to delete this annotation?';
if ($window.confirm(msg)) { if ($window.confirm(msg)) {
......
...@@ -275,7 +275,7 @@ describe('annotation', function() { ...@@ -275,7 +275,7 @@ describe('annotation', function() {
}; };
var originalPermissions = JSON.parse(JSON.stringify( var originalPermissions = JSON.parse(JSON.stringify(
annotation.permissions)); annotation.permissions));
fakePermissions['default'] = function () { fakePermissions.default = function () {
return 'new permissions'; return 'new permissions';
}; };
fakePermissions.isShared = function () {}; fakePermissions.isShared = function () {};
...@@ -604,7 +604,7 @@ describe('annotation', function() { ...@@ -604,7 +604,7 @@ describe('annotation', function() {
var parts = createDirective(); var parts = createDirective();
sandbox.stub($window, 'confirm').returns(true); sandbox.stub($window, 'confirm').returns(true);
fakeAnnotationMapper.deleteAnnotation.returns($q.resolve()); fakeAnnotationMapper.deleteAnnotation.returns($q.resolve());
parts.controller['delete']().then(function() { parts.controller.delete().then(function() {
assert.calledWith(fakeAnnotationMapper.deleteAnnotation, assert.calledWith(fakeAnnotationMapper.deleteAnnotation,
parts.annotation); parts.annotation);
done(); done();
...@@ -618,7 +618,7 @@ describe('annotation', function() { ...@@ -618,7 +618,7 @@ describe('annotation', function() {
function(done) { function(done) {
var parts = createDirective(); var parts = createDirective();
sandbox.stub($window, 'confirm').returns(false); sandbox.stub($window, 'confirm').returns(false);
parts.controller['delete']().then(function() { parts.controller.delete().then(function() {
assert.notCalled(fakeAnnotationMapper.deleteAnnotation); assert.notCalled(fakeAnnotationMapper.deleteAnnotation);
done(); done();
}); });
...@@ -634,7 +634,7 @@ describe('annotation', function() { ...@@ -634,7 +634,7 @@ describe('annotation', function() {
fakeAnnotationMapper.deleteAnnotation.returns($q.reject({ fakeAnnotationMapper.deleteAnnotation.returns($q.reject({
status: 0 status: 0
})); }));
controller['delete']().then(function() { controller.delete().then(function() {
assert.calledWith(fakeFlash.error, assert.calledWith(fakeFlash.error,
'Service unreachable.', 'Deleting annotation failed'); 'Service unreachable.', 'Deleting annotation failed');
done(); done();
...@@ -651,7 +651,7 @@ describe('annotation', function() { ...@@ -651,7 +651,7 @@ describe('annotation', function() {
statusText: 'Server Error', statusText: 'Server Error',
data: {} data: {}
})); }));
controller['delete']().then(function() { controller.delete().then(function() {
assert.calledWith(fakeFlash.error, assert.calledWith(fakeFlash.error,
'500 Server Error', 'Deleting annotation failed'); '500 Server Error', 'Deleting annotation failed');
done(); done();
...@@ -663,7 +663,7 @@ describe('annotation', function() { ...@@ -663,7 +663,7 @@ describe('annotation', function() {
var controller = createDirective().controller; var controller = createDirective().controller;
sandbox.stub($window, 'confirm').returns(true); sandbox.stub($window, 'confirm').returns(true);
fakeAnnotationMapper.deleteAnnotation.returns($q.resolve()); fakeAnnotationMapper.deleteAnnotation.returns($q.resolve());
controller['delete']().then(function() { controller.delete().then(function() {
assert.notCalled(fakeFlash.error); assert.notCalled(fakeFlash.error);
done(); done();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment