style(aio): fix docs linting issues (#19702)

These issues appeared after upgrade of eslint jasmine plugin

PR Close #19702
This commit is contained in:
Peter Bacon Darwin 2017-10-25 15:02:01 +01:00 committed by Matias Niemelä
parent e9afc59a81
commit 9ab1f4a9c9
5 changed files with 7 additions and 5 deletions

View File

@ -15,6 +15,7 @@ module.exports = {
'indent': ['error', 2], 'indent': ['error', 2],
'linebreak-style': ['error', 'unix'], 'linebreak-style': ['error', 'unix'],
'quotes': ['error', 'single'], 'quotes': ['error', 'single'],
'semi': ['error', 'always'] 'semi': ['error', 'always'],
'jasmine/new-line-before-expect': 0
} }
}; };

View File

@ -55,7 +55,7 @@ describe('addImageDimensions post-processor', () => {
docType: 'a', docType: 'a',
renderedContent: '<img attr="value">' renderedContent: '<img attr="value">'
})]); })]);
expect(log.warn).toHaveBeenCalled(); expect(log.warn).toHaveBeenCalledWith('Missing src in image tag `<img attr="value">` - doc (a) ');
}); });
it('should fail for images whose source cannot be loaded', () => { it('should fail for images whose source cannot be loaded', () => {
@ -69,7 +69,7 @@ describe('addImageDimensions post-processor', () => {
renderedContent: '<img src="missing">' renderedContent: '<img src="missing">'
}]; }];
expect(() => processor.$process(docs)).toThrowError('Unable to load src in image tag `<img src="missing">` - doc (a) '); expect(() => processor.$process(docs)).toThrowError('Unable to load src in image tag `<img src="missing">` - doc (a) ');
expect(getImageDimensionsSpy).toHaveBeenCalled(); expect(getImageDimensionsSpy).toHaveBeenCalledWith('base/path', 'missing');
}); });
it('should ignore images with width or height attributes', () => { it('should ignore images with width or height attributes', () => {

View File

@ -70,6 +70,6 @@ describe('convertToJson processor', () => {
it('should log a warning', () => { it('should log a warning', () => {
const docs = [{ docType: 'test-doc' }]; const docs = [{ docType: 'test-doc' }];
processor.$process(docs); processor.$process(docs);
expect(log.warn).toHaveBeenCalled(); expect(log.warn).toHaveBeenCalledWith('Title property expected - doc (test-doc) ');
}); });
}); });

View File

@ -1,3 +1,4 @@
/* eslint jasmine/prefer-toHaveBeenCalledWith:0 */
const fs = require('fs'); const fs = require('fs');
const {resolve} = require('canonical-path'); const {resolve} = require('canonical-path');
const {generateDocs} = require('./index.js'); const {generateDocs} = require('./index.js');

View File

@ -68,7 +68,7 @@ describe('postProcessHtml', function() {
}; };
processor.plugins = [() => addWarning]; processor.plugins = [() => addWarning];
processor.$process([{ docType: 'a', renderedContent: '' }]); processor.$process([{ docType: 'a', renderedContent: '' }]);
expect(log.warn).toHaveBeenCalled(); expect(log.warn).toHaveBeenCalledWith('There was a problem - doc (a) ');
}); });
it('should throw on fatal errors', () => { it('should throw on fatal errors', () => {