Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
1000ch committed Feb 21, 2016
1 parent e4c040a commit 05485d3
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions spec/linter-htmlhint-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,42 @@ describe('The htmlhint provider for Linter', () => {
beforeEach(() => {
atom.workspace.destroyActivePaneItem();
waitsForPromise(() =>
atom.packages.activatePackage('linter-htmlhint').then(() =>
atom.packages.activatePackage('language-html')
)
atom
.packages
.activatePackage('linter-htmlhint')
.then(() => atom.packages.activatePackage('language-html'))
);
});

it('detects invalid coding style in bad.html and report as error', () => {
waitsForPromise(() => {
const bad = path.join(__dirname, 'fixtures', 'bad.html');
return atom.workspace.open(bad).then(editor => lint(editor)).then(messages => {
expect(messages.length).toEqual(1);
return atom
.workspace
.open(bad)
.then(editor => lint(editor))
.then(messages => {
expect(messages.length).toEqual(1);

// test only the first error
expect(messages[0].type).toEqual('error');
expect(messages[0].text).toEqual('Doctype must be declared first.');
expect(messages[0].filePath).toMatch(/.+bad\.html$/);
expect(messages[0].range).toEqual([[0, 0], [0, 13]]);
});
// test only the first error
expect(messages[0].type).toEqual('error');
expect(messages[0].text).toEqual('Doctype must be declared first.');
expect(messages[0].filePath).toMatch(/.+bad\.html$/);
expect(messages[0].range).toEqual([[0, 0], [0, 13]]);
});
});
});

it('finds nothing wrong with a valid file (good.html)', () => {
waitsForPromise(() => {
const good = path.join(__dirname, 'fixtures', 'good.html');
return atom.workspace.open(good).then(editor => lint(editor)).then(messages => {
expect(messages.length).toEqual(0);
});
return atom
.workspace
.open(good)
.then(editor => lint(editor))
.then(messages => {
expect(messages.length).toEqual(0);
});
});
});
});

0 comments on commit 05485d3

Please sign in to comment.