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 @@
"array-callback-return": "error",
"block-scoped-var": "error",
"curly": "error",
"dot-notation": "error",
"eqeqeq": "error",
"no-console": [
"error",
......
......@@ -143,7 +143,7 @@ function AnnotationController(
vm.annotation.user = vm.annotation.user || session.state.userid;
vm.annotation.group = vm.annotation.group || groups.focused().id;
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 || '';
if (!Array.isArray(vm.annotation.tags)) {
......@@ -236,7 +236,7 @@ function AnnotationController(
* @name annotation.AnnotationController#delete
* @description Deletes the annotation.
*/
vm['delete'] = function() {
vm.delete = function() {
return $timeout(function() { // Don't use confirm inside the digest cycle.
var msg = 'Are you sure you want to delete this annotation?';
if ($window.confirm(msg)) {
......
......@@ -275,7 +275,7 @@ describe('annotation', function() {
};
var originalPermissions = JSON.parse(JSON.stringify(
annotation.permissions));
fakePermissions['default'] = function () {
fakePermissions.default = function () {
return 'new permissions';
};
fakePermissions.isShared = function () {};
......@@ -604,7 +604,7 @@ describe('annotation', function() {
var parts = createDirective();
sandbox.stub($window, 'confirm').returns(true);
fakeAnnotationMapper.deleteAnnotation.returns($q.resolve());
parts.controller['delete']().then(function() {
parts.controller.delete().then(function() {
assert.calledWith(fakeAnnotationMapper.deleteAnnotation,
parts.annotation);
done();
......@@ -618,7 +618,7 @@ describe('annotation', function() {
function(done) {
var parts = createDirective();
sandbox.stub($window, 'confirm').returns(false);
parts.controller['delete']().then(function() {
parts.controller.delete().then(function() {
assert.notCalled(fakeAnnotationMapper.deleteAnnotation);
done();
});
......@@ -634,7 +634,7 @@ describe('annotation', function() {
fakeAnnotationMapper.deleteAnnotation.returns($q.reject({
status: 0
}));
controller['delete']().then(function() {
controller.delete().then(function() {
assert.calledWith(fakeFlash.error,
'Service unreachable.', 'Deleting annotation failed');
done();
......@@ -651,7 +651,7 @@ describe('annotation', function() {
statusText: 'Server Error',
data: {}
}));
controller['delete']().then(function() {
controller.delete().then(function() {
assert.calledWith(fakeFlash.error,
'500 Server Error', 'Deleting annotation failed');
done();
......@@ -663,7 +663,7 @@ describe('annotation', function() {
var controller = createDirective().controller;
sandbox.stub($window, 'confirm').returns(true);
fakeAnnotationMapper.deleteAnnotation.returns($q.resolve());
controller['delete']().then(function() {
controller.delete().then(function() {
assert.notCalled(fakeFlash.error);
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