-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
2 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,74 +1,74 @@ | ||
import test from 'ava'; | ||
import postcss from 'postcss'; | ||
import plugin from '../src/'; | ||
import plugin from '../src'; | ||
|
||
const processing = (inputCSS, options) => postcss([plugin(options)]).process(inputCSS).css; | ||
|
||
test('processing not options and not attribute selector', t => { | ||
const expected = '.class, .test { color:red; }'; | ||
const fixtures = '.class, .test { color:red; }'; | ||
t.is(processing(fixtures), expected); | ||
const expected = '.class, .test { color:red; }'; | ||
const fixtures = '.class, .test { color:red; }'; | ||
t.is(processing(fixtures), expected); | ||
}); | ||
|
||
test('processing options prefix and not attribute selector', t => { | ||
const expected = '.class { color:red; }'; | ||
const fixtures = '.class { color:red; }'; | ||
t.is(processing(fixtures, {prefix: 'test-'}), expected); | ||
const expected = '.class { color:red; }'; | ||
const fixtures = '.class { color:red; }'; | ||
t.is(processing(fixtures, {prefix: 'test-'}), expected); | ||
}); | ||
|
||
test('processing options prefix multiple', t => { | ||
const expected = '.class, [type="test-text"], [class*="test-lorem-1 test-lorem-2"], [id^="test-myID"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem-1 lorem-2"], [id^="myID"] { color:red; }'; | ||
t.is(processing(fixtures, {prefix: 'test-'}), expected); | ||
const expected = '.class, [type="test-text"], [class*="test-lorem-1 test-lorem-2"], [id^="test-myID"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem-1 lorem-2"], [id^="myID"] { color:red; }'; | ||
t.is(processing(fixtures, {prefix: 'test-'}), expected); | ||
}); | ||
|
||
test('processing options prefix and attribute selector', t => { | ||
const expected = '.class, [type="test-text"] { color:red; }'; | ||
const fixtures = '.class, [type="text"] { color:red; }'; | ||
t.is(processing(fixtures, {prefix: 'test-'}), expected); | ||
const expected = '.class, [type="test-text"] { color:red; }'; | ||
const fixtures = '.class, [type="text"] { color:red; }'; | ||
t.is(processing(fixtures, {prefix: 'test-'}), expected); | ||
}); | ||
|
||
test('processing options prefix, filter and attribute selector', t => { | ||
const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test-', | ||
filter: ['class'] | ||
}), expected); | ||
const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test-', | ||
filter: ['class'] | ||
}), expected); | ||
}); | ||
|
||
test('processing options prefix, filter and attribute selector witch indentical class filter', t => { | ||
const expected = '.class, [type="text"], [alt*="class"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [alt*="class"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test-', | ||
filter: ['class'] | ||
}), expected); | ||
const expected = '.class, [type="text"], [alt*="class"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [alt*="class"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test-', | ||
filter: ['class'] | ||
}), expected); | ||
}); | ||
|
||
test('processing options filter and attribute selector', t => { | ||
const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
filter: ['class'] | ||
}), expected); | ||
const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
filter: ['class'] | ||
}), expected); | ||
}); | ||
|
||
test('processing options prefix, filter, ignore and attribute selector', t => { | ||
const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test', | ||
filter: ['class'], | ||
ignore: ['class'] | ||
}), expected); | ||
const expected = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test', | ||
filter: ['class'], | ||
ignore: ['class'] | ||
}), expected); | ||
}); | ||
|
||
test('processing options prefix, ignore and attribute selector', t => { | ||
const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test-', | ||
ignore: ['type'] | ||
}), expected); | ||
const expected = '.class, [type="text"], [class*="test-lorem"] { color:red; }'; | ||
const fixtures = '.class, [type="text"], [class*="lorem"] { color:red; }'; | ||
t.is(processing(fixtures, { | ||
prefix: 'test-', | ||
ignore: ['type'] | ||
}), expected); | ||
}); |