This repository has been archived by the owner on Aug 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
610c695
commit d0f8a6c
Showing
7 changed files
with
173 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.div {} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.div { | ||
color: blue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
'use babel'; | ||
/* eslint-env jasmine */ | ||
|
||
describe('The csslint provider for Linter', () => { | ||
const lint = require('../lib/main').provideLinter().lint; | ||
|
||
beforeEach(() => { | ||
atom.workspace.destroyActivePaneItem(); | ||
waitsForPromise(() => { | ||
atom.packages.activatePackage('linter-csslint'); | ||
return atom.packages.activatePackage('language-css').then(() => | ||
atom.workspace.open(__dirname + '/fixtures/empty.css') | ||
); | ||
}); | ||
}); | ||
|
||
it('should be in the packages list', () => { | ||
return expect(atom.packages.isPackageLoaded('linter-css')).toBe(true); | ||
}); | ||
|
||
it('should be an active package', () => { | ||
return expect(atom.packages.isPackageActive('linter-css')).toBe(true); | ||
}); | ||
|
||
describe('checks bad.css and', () => { | ||
let editor = null; | ||
beforeEach(() => { | ||
waitsForPromise(() => { | ||
return atom.workspace.open(__dirname + '/fixtures/bad.css').then(openEditor => { | ||
editor = openEditor; | ||
}); | ||
}); | ||
}); | ||
|
||
it('finds at least one message', () => { | ||
waitsForPromise(() => { | ||
return lint(editor).then(messages => { | ||
expect(messages.length).toBeGreaterThan(0); | ||
}); | ||
}); | ||
}); | ||
|
||
it('verifies the first message', () => { | ||
waitsForPromise(() => { | ||
return lint(editor).then(messages => { | ||
expect(messages[0].type).toBeDefined(); | ||
expect(messages[0].type).toEqual('Warning'); | ||
expect(messages[0].text).toBeDefined(); | ||
expect(messages[0].text).toEqual('Rule is empty.'); | ||
expect(messages[0].filePath).toBeDefined(); | ||
expect(messages[0].filePath).toMatch(/.+bad\.css$/); | ||
expect(messages[0].range).toBeDefined(); | ||
expect(messages[0].range.length).toEqual(2); | ||
expect(messages[0].range).toEqual([[0, 0], [0, 0]]); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('warns on invalid CSS', () => { | ||
let editor = null; | ||
beforeEach(() => { | ||
waitsForPromise(() => { | ||
return atom.workspace.open(__dirname + '/fixtures/invalid.css').then(openEditor => { | ||
editor = openEditor; | ||
}); | ||
}); | ||
}); | ||
|
||
it('finds one message', () => { | ||
waitsForPromise(() => { | ||
return lint(editor).then(messages => { | ||
expect(messages.length).toBe(1); | ||
}); | ||
}); | ||
}); | ||
|
||
it('verifies the message', () => { | ||
waitsForPromise(() => { | ||
return lint(editor).then(messages => { | ||
expect(messages[0].type).toBeDefined(); | ||
expect(messages[0].type).toEqual('Error'); | ||
expect(messages[0].text).toBeDefined(); | ||
expect(messages[0].text).toEqual('Unexpected token \'}\' at line 1, col 1.'); | ||
expect(messages[0].filePath).toBeDefined(); | ||
expect(messages[0].filePath).toMatch(/.+invalid\.css$/); | ||
expect(messages[0].range).toBeDefined(); | ||
expect(messages[0].range.length).toEqual(2); | ||
expect(messages[0].range).toEqual([[0, 0], [0, 0]]); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it('finds nothing wrong with an empty file', () => { | ||
waitsForPromise(() => { | ||
return atom.workspace.open(__dirname + '/fixtures/empty.css').then(editor => { | ||
return lint(editor).then(messages => { | ||
expect(messages.length).toEqual(0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it('finds nothing wrong with a valid file', () => { | ||
waitsForPromise(() => { | ||
return atom.workspace.open(__dirname + '/fixtures/good.css').then(editor => { | ||
return lint(editor).then(messages => { | ||
expect(messages.length).toEqual(0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |