Fix JSCS errors

This commit is contained in:
Rowan Manning
2016-04-25 21:26:59 +01:00
parent 90328cfa39
commit ea48d6a6fd
31 changed files with 366 additions and 364 deletions

View File

@@ -17,9 +17,9 @@
var assert = require('proclaim');
describe('GET /<task-id>/edit', function () {
describe('GET /<task-id>/edit', function() {
beforeEach(function (done) {
beforeEach(function(done) {
var req = {
method: 'GET',
endpoint: '/abc000000000000000000001/edit'
@@ -27,35 +27,35 @@ describe('GET /<task-id>/edit', function () {
this.navigate(req, done);
});
it('should send a 200 status', function () {
it('should send a 200 status', function() {
assert.strictEqual(this.last.status, 200);
});
it('should have an "Edit URL" form', function () {
it('should have an "Edit URL" form', function() {
var form = this.last.dom.querySelectorAll('[data-test=edit-url-form]')[0];
assert.isDefined(form);
assert.strictEqual(form.getAttribute('action'), '/abc000000000000000000001/edit');
assert.strictEqual(form.getAttribute('method'), 'post');
});
it('should display a link back to the task page', function () {
it('should display a link back to the task page', function() {
assert.greaterThan(this.last.dom.querySelectorAll('[href="/abc000000000000000000001"]').length, 0);
});
describe('"Edit URL" form', function () {
describe('"Edit URL" form', function() {
beforeEach(function () {
beforeEach(function() {
this.form = this.last.dom.querySelectorAll('[data-test=edit-url-form]')[0];
});
it('should have a "name" field', function () {
it('should have a "name" field', function() {
var field = this.form.querySelectorAll('input[name=name]')[0];
assert.isDefined(field);
assert.strictEqual(field.getAttribute('type'), 'text');
assert.strictEqual(field.getAttribute('value'), 'NPG Home');
});
it('should have a disabled "url" field', function () {
it('should have a disabled "url" field', function() {
var field = this.form.querySelectorAll('input[name=url]')[0];
assert.isDefined(field);
assert.strictEqual(field.getAttribute('type'), 'url');
@@ -63,27 +63,27 @@ describe('GET /<task-id>/edit', function () {
assert.isDefined(field.getAttribute('disabled'));
});
it('should have a disabled "standard" field', function () {
it('should have a disabled "standard" field', function() {
var field = this.form.querySelectorAll('select[name=standard]')[0];
assert.isDefined(field);
assert.isDefined(field.getAttribute('disabled'));
});
it('should have a "username" field', function () {
it('should have a "username" field', function() {
var field = this.form.querySelectorAll('input[name=username]')[0];
assert.isDefined(field);
assert.strictEqual(field.getAttribute('type'), 'text');
assert.strictEqual(field.getAttribute('value'), 'user');
});
it('should have a "password" field', function () {
it('should have a "password" field', function() {
var field = this.form.querySelectorAll('input[name=password]')[0];
assert.isDefined(field);
assert.strictEqual(field.getAttribute('type'), 'text');
assert.strictEqual(field.getAttribute('value'), 'access');
});
it('should have "ignore" fields', function () {
it('should have "ignore" fields', function() {
var fields = this.form.querySelectorAll('input[name="ignore[]"]');
assert.isDefined(fields);
assert.notStrictEqual(fields.length, 0);
@@ -93,9 +93,9 @@ describe('GET /<task-id>/edit', function () {
});
describe('POST /<task-id>/edit', function () {
describe('POST /<task-id>/edit', function() {
beforeEach(function (done) {
beforeEach(function(done) {
var req = {
method: 'POST',
endpoint: '/abc000000000000000000001/edit',
@@ -109,12 +109,12 @@ describe('POST /<task-id>/edit', function () {
this.navigate(req, done);
});
it('should send a 200 status', function () {
it('should send a 200 status', function() {
assert.strictEqual(this.last.status, 200);
});
it('should edit the task', function (done) {
this.webservice.task('abc000000000000000000001').get({}, function (err, task) {
it('should edit the task', function(done) {
this.webservice.task('abc000000000000000000001').get({}, function(err, task) {
assert.strictEqual(task.name, 'foo');
assert.strictEqual(task.username, 'newuser');
assert.strictEqual(task.password, 'secure');
@@ -123,7 +123,7 @@ describe('POST /<task-id>/edit', function () {
});
});
it('should display a success message', function () {
it('should display a success message', function() {
var alert = this.last.dom.querySelectorAll('[data-test=alert]')[0];
assert.isDefined(alert);
assert.match(alert.textContent, /been saved/i);