Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

25
node_modules/doiuse/test/cases/backgrounds.css generated vendored Normal file
View File

@@ -0,0 +1,25 @@
/*
expect:
background-img-opts: 3
multibackgrounds: 3
css-canvas: 1
*/
a {
background-size: cover;
background-origin: padding-box;
background-clip: padding-box;
}
div {
background: url(a.gif), url(b.gif);
background-image: url(c.gif), url(d.gif);
}
.another {
background-repeat: no-repeat, no-repeat;
}
.wc {
background: -webkit-canvas(squares);
}

12
node_modules/doiuse/test/cases/counters.css generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/*
expect:
css-counters: 2
*/
article {
counter-reset: section;
}
h2 {
counter-increment: section;
}

23
node_modules/doiuse/test/cases/cursors.css generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/*
expect:
css3-cursors: 13
css3-cursors-newer: 2
*/
.klass { cursor: pointer; }
.klass { cursor: none; }
.klass { cursor: context-menu; }
.klass { cursor: cell; }
.klass { cursor: vertical-text; }
.klass { cursor: alias; }
.klass { cursor: copy; }
.klass { cursor: no-drop; }
.klass { cursor: not-allowed; }
.klass { cursor: nesw-resize; }
.klass { cursor: nwse-resize; }
.klass { cursor: col-resize; }
.klass { cursor: row-resize; }
.klass { cursor: all-scroll; }
.klass { cursor: zoom-in; }
.klass { cursor: zoom-out; }

21
node_modules/doiuse/test/cases/gradient.css generated vendored Normal file
View File

@@ -0,0 +1,21 @@
/*
expect:
css-gradients: 2
css-repeating-gradients: 2
*/
.radial {
background: radial-gradient(ellipse farthest-corner, black, white);
}
.simple1 {
background: linear-gradient(black, white);
}
.repeating {
background: repeating-linear-gradient(180deg,rgb(26,198,204),rgb(26,198,204) 7%, rgb(100,100,100) 10%);
}
.color {
background: red repeating-radial-gradient(ellipse farthest-corner, black, white);
}

25
node_modules/doiuse/test/cases/ignore-comment.css generated vendored Normal file
View File

@@ -0,0 +1,25 @@
/* doiuse-disable */
disable-all {
display: flex;
}
/* doiuse-enable flexbox */
enable-specific {
display: flex;
}
/* doiuse-disable flexbox, css-filters */
disable-specific {
display: flex;
filter: brightness(50%);
}
/* doiuse-enable */
enable-all {
display: flex;
}
/* doiuse-disable */
/* applies to included files */
@import "./ignore-include.css";
/* but not to other file */

3
node_modules/doiuse/test/cases/ignore-file.css generated vendored Normal file
View File

@@ -0,0 +1,3 @@
body {
display: flex;
}

2
node_modules/doiuse/test/cases/ignore-import.css generated vendored Normal file
View File

@@ -0,0 +1,2 @@
@import "./ignore-file.css";
@import "./ignore-include.css";

3
node_modules/doiuse/test/cases/ignore-include.css generated vendored Normal file
View File

@@ -0,0 +1,3 @@
.container {
user-select: none;
}

12
node_modules/doiuse/test/cases/issue17.css generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/*
expect:
viewport-units: 0
*/
.icon {
background-image: url('data:image/png;base64,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');
background-position: center;
background-repeat: no-repeat;
background-size: 45px 45px;
height: 45px;
width: 45px;
}

8
node_modules/doiuse/test/cases/object-fit.css generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/*
expect:
object-fit: 1
*/
div {
object-fit: contain;
}

8
node_modules/doiuse/test/cases/opacity.css generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/*
expect:
css-opacity: 1
*/
.panel {
opacity: .5;
}

12
node_modules/doiuse/test/cases/outline.css generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/*
expect:
outline: 2
*/
button {
outline: none;
}
a {
outline-color: #000;
}

8
node_modules/doiuse/test/cases/overflow-wrap.css generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/*
expect:
wordwrap: 1
*/
p {
overflow-wrap: break-word;
}

6
node_modules/doiuse/test/cases/pointer-events.css generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/*
expect:
pointer-events: 1
*/
div .label { pointer-events: none; }

18
node_modules/doiuse/test/cases/queries.css generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/*
expect:
css-mediaqueries: 2
css-featurequeries: 1
css-media-resolution: 1
*/
@media only screen {
.ui { display: block; }
}
@supports (transform-origin: 5% 5%) {
.ui { transform-origin: 5% 5%; }
}
@media (min-resolution: 192dpi) {
.ui { width: 50%; }
}

6
node_modules/doiuse/test/cases/rem.css generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/*
expect:
rem: 1
*/
p { font-size: 1rem; }

8
node_modules/doiuse/test/cases/resize.css generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/*
expect:
css-resize: 1
*/
textarea {
resize: both;
}

47
node_modules/doiuse/test/cases/selectors.css generated vendored Normal file
View File

@@ -0,0 +1,47 @@
/*
expect:
css-sel2: 16
css-sel3: 20
*/
/* level 2 */
* { color: #000000; }
div > div { color: #000000; }
div:first-child { color: #000000; }
a:link { color: #000000; }
a:visited { color: #000000; }
a:active { color: #000000; }
a:hover { color: #000000; }
a:focus { color: #000000; }
*:lang(en) { color: #000000; }
* + * { color: #000000; }
[href] { color: #000000; }
[href="http://doiuse.com"] { color: #000000; }
[class~="column"] { color: #000000; }
[lang|="en"] { color: #000000; }
.classname { color: #000000; }
#elementid { color: #000000; }
/* level 3 */
[href^="http"] { color: #000000; }
[href$=".com"] { color: #000000; }
[href *= "http"] { color: #000000; }
:root { color: #000000; }
div:nth-child(2n+1) { color: #000000; }
div:nth-last-child(2) { color: #000000; }
div:nth-of-type(2) { color: #000000; }
div:nth-last-of-type(2) { color: #000000; }
div:last-child { color: #000000; }
div:first-of-type { color: #000000; }
div:last-of-type { color: #000000; }
div:only-child { color: #000000; }
div:only-of-type { color: #000000; }
div:empty { color: #000000; }
a:target { color: #000000; }
button:enabled { color: #000000; }
button:disabled { color: #000000; }
option:checked { color: #000000; }
div:not(.active) { color: #000000; }
h1 ~ p { color: #000000; }

7
node_modules/doiuse/test/cases/text-overflow.css generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/*
expect:
text-overflow: 1
*/
h1 {
text-overflow: ellipsis;
}

View File

@@ -0,0 +1,14 @@
a {
transition: transform 1s;
transform: rotateX(45deg)
}
b {
transform: translateX(45deg)
}
@keyframes anim {
from {
transform: rotate(90deg);
}
}

View File

@@ -0,0 +1,3 @@
a {
border-image: linear-gradient(black, white) 20% fill stretch stretch;
}

View File

@@ -0,0 +1,5 @@
a {
border-radius: 5px;
border-top-left-radius: 3px;
border-bottom-right-radius: 3px;
}

View File

@@ -0,0 +1,6 @@
a {
flex-direction: row;
transition: all 1s
}
b { transition: all 1s }

View File

@@ -0,0 +1,4 @@
* {
transition: all 1s;
-o-transition: all 1s
}

View File

@@ -0,0 +1,8 @@
a {
/* transition */
transition: all 1s;
height: calc(/* comment before */100% - /* comment inside */ 10px/* comment after */);
}
/* placeholder */
::placeholder { }

View File

@@ -0,0 +1,3 @@
a {
-evil-up: calc(10px + 1);
}

View File

@@ -0,0 +1,29 @@
a {
-webkit-border-radius: 4px;
border-radius: 4px;
transition: transform 1s;
}
b {
/* autoprefixer: off */
-webkit-border-radius: 4px;
border-radius: 4px;
transition: transform 1s;
}
@support (transition: 1s) {
/* autoprefixer: off */
:fullscreen {
-webkit-border-radius: 4px;
border-radius: 4px;
transition: transform 1s;
}
::placeholder {
/*autoprefixer: on*/
-webkit-border-radius: 4px;
border-radius: 4px;
transition: transform 1s;
}
}

View File

@@ -0,0 +1,4 @@
a {
flex-basis: 8.33333%;
flex-basis: calc(100% / 12 * 1)
}

View File

@@ -0,0 +1,3 @@
:fullscreen a {
transition: transform 1s
}

View File

@@ -0,0 +1,16 @@
a {
filter: blur(10px);
transition: filter 2s;
}
div {
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
}
b {
filter: alpha(opacity=100);
}
em {
filter: Alpha(opacity=100);
}

View File

@@ -0,0 +1,3 @@
.a {
flex-grow: 0;
}

View File

@@ -0,0 +1,54 @@
a {
display: flex;
flex-flow: row;
order: 0;
flex: 0 1 2;
transition: flex 200ms;
}
.inline {
display: inline-flex;
align-self: auto;
align-content: stretch;
flex: auto;
}
.a {
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
flex-wrap: nowrap;
align-content: flex-start;
align-self: flex-start;
flex: none;
}
.b {
flex-direction: row-reverse;
justify-content: flex-end;
align-items: flex-end;
flex-wrap: wrap;
align-content: flex-end;
align-self: flex-end;
flex-shrink: 1;
}
.c {
flex-direction: column;
justify-content: center;
align-items: center;
flex-wrap: reverse-wrap;
align-content: center;
align-self: center;
flex-basis: auto;
}
.e {
flex-direction: column-reverse;
justify-content: space-between;
align-items: baseline;
align-content: space-between;
align-self: baseline;
}
.f {
justify-content: space-around;
align-items: stretch;
align-content: space-around;
align-self: stretch;
}

View File

@@ -0,0 +1,18 @@
:fullscreen {
background: black
}
[href=:fullscreen] {}
:fullscreen a {
box-sizing: border-box
}
:fullscreen a {
color: black
}
:-moz-full-screen a {
transform: translate3d(0, 0, 0);
}

View File

@@ -0,0 +1,7 @@
a {
width: fill-available;
}
b {
height: max-content;
}

View File

@@ -0,0 +1,18 @@
@keyframes anim {
from {
top: calc(10% + 10px);
transform: rotate(10deg)
}
50% {
top: 0;
display: flex
}
to {
top: calc(10%);
transform: rotate(0)
}
}
@media screen {
@keyframes inside {}
}

View File

@@ -0,0 +1,10 @@
a {
-ms-transition: all 1s;
transition: all 1s;
-ms-border-radius: 5px;
border-radius: 5px;
background: -ms-linear-gradient(white, black);
background: linear-gradient(white, black);
}

View File

@@ -0,0 +1,19 @@
.a {
break-inside: auto
}
.b {
break-inside: avoid
}
.c {
break-inside: avoid-column
}
.d {
break-inside: avoid-page
}
.e {
break-inside: avoid-region
}

View File

@@ -0,0 +1,3 @@
a {
display: flex;
}

3
node_modules/doiuse/test/cases/unimplemented/pie.css generated vendored Normal file
View File

@@ -0,0 +1,3 @@
a {
-pie-background: linear-gradient(white, black)
}

View File

@@ -0,0 +1,4 @@
::placeholder {
color: #999
}

View File

@@ -0,0 +1,5 @@
a {
color : black;
display: flex;
transition: 1s
}

View File

@@ -0,0 +1,8 @@
@supports
(cursor: grab) or
not (transition: transform) and
(color: black) {
a {
color: black;
}
}

View File

@@ -0,0 +1,17 @@
@page {
margin: 0.5cm;
}
/* comment */
@-moz-document url-prefix() {
a {
color: black;
}
}
a {
/* c */
color/**/: white;
padding: 0 /*{}*/ 1px /*}*/ 2px;
}

View File

@@ -0,0 +1,9 @@
a {
transition: transform 200ms, color 200ms;
transform: rotate(10deg);
}
div {
transition-property: filter;
animation-name: rotating;
}

View File

@@ -0,0 +1,4 @@
a {
background: -webkit-linear-gradient(top, #f00 0%, #fff 100%);
background: linear-gradient(to bottom, #f00 0%, #fff 100%);
}

View File

@@ -0,0 +1,17 @@
a {
-webkit-transition: 1s;
-moz-transition: 1s;
transition: 1s
}
a {
-moz-transition: 1s;
-o-transition: 1s;
transition: 1s
}
a {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px
}

View File

@@ -0,0 +1,5 @@
a {
margin: calc(5% + 5px) calc(10% + 10px);
background: linear-gradient(black, white), radial-gradient(white, black);
content: " linear-gradient(black, white) ";
}

View File

@@ -0,0 +1,13 @@
.a {
-moz-transform: scale(.9999);
transform: scale(.9999);
}
.b {
-moz-transform: scale(.9999);
}
.c {
transform: scale(1);
-moz-transform: scale(2);
}

11
node_modules/doiuse/test/cases/viewport-units.css generated vendored Normal file
View File

@@ -0,0 +1,11 @@
/*
expect:
viewport-units: 4
*/
div {
width: 100vmin;
border-right-width: 1vw;
border-bottom-width: 1vh;
height: 100vmax;
}

6
node_modules/doiuse/test/cases/word-break.css generated vendored Normal file
View File

@@ -0,0 +1,6 @@
/*
expect:
word-break: 1
*/
p { word-break: break-all; }

92
node_modules/doiuse/test/cli.js generated vendored Normal file
View File

@@ -0,0 +1,92 @@
var cpExec = require('child_process').exec
var path = require('path')
var test = require('tape')
var cssFile = path.join(__dirname, '/cases/gradient.css')
var pathToCli = ' node ' + path.join(__dirname, '../cli.js')
var catCss = ' cat ' + cssFile + ' | tee /dev/tty '
var expectedCssGradients = '<streaming css input>:8:1: CSS Gradients not supported by: IE (8,9) (css-gradients)\n' +
'<streaming css input>:12:1: CSS Gradients not supported by: IE (8,9) (css-gradients)\n'
var expectedCssRepeatingGradients = '<streaming css input>:16:1: CSS Repeating Gradients not supported by: IE (8,9) (css-repeating-gradients)\n' +
'<streaming css input>:20:1: CSS Repeating Gradients not supported by: IE (8,9) (css-repeating-gradients)\n'
var expected = expectedCssGradients + expectedCssRepeatingGradients
var commands = {
cat: catCss,
doiuse: pathToCli + ' --browsers="IE >= 8" '
}
var expectedWithIgnore = expectedCssRepeatingGradients
var commandsWithIgnore = {
cat: catCss,
doiuse: pathToCli + ' --browsers="IE >= 8" --ignore="css-gradients" '
}
var exec = function (cmd, cb) {
console.log(cmd)
cpExec(cmd, cb)
}
test('cli command: piped input', function (t) {
exec(commands.cat + ' | ' + commands.doiuse, function (error, stdout, stderr) {
t.equal(stdout, expected)
t.end(error)
})
})
test('should take filename as input', function (t) {
exec(commands.doiuse + cssFile, function (error, stdout, stderr) {
t.equal(stdout, expected.replace(/<streaming css input>/g, cssFile))
t.end(error)
})
})
test('cli command with ignore: piped input', function (t) {
exec(commandsWithIgnore.cat + ' | ' + commandsWithIgnore.doiuse, function (error, stdout, stderr) {
t.equal(stdout, expectedWithIgnore)
t.end(error)
})
})
test('should take filename as input with ignore', function (t) {
exec(commandsWithIgnore.doiuse + cssFile, function (error, stdout, stderr) {
t.equal(stdout, expectedWithIgnore.replace(/<streaming css input>/g, cssFile))
t.end(error)
})
})
test('--json option should work', function (t) {
exec(commands.doiuse + '--json ' + cssFile, function (error, stdout, stderr) {
var result = stdout.trim()
.split(/\r?\n/)
.map(JSON.parse.bind(JSON))
.map(function (usage) { return usage.feature })
t.deepEqual(result, [
'css-gradients',
'css-gradients',
'css-repeating-gradients',
'css-repeating-gradients' ])
t.end(error)
})
})
test('--list-only should work', function (t) {
exec(commands.doiuse + '--list-only', function (error, stdout, stderr) {
t.equal(stdout.trim(), '[doiuse] Browsers: IE 8, IE 9, IE 10, IE 11')
t.end(error)
})
})
test('-c config file should work as input parameters', function (t) {
var configFile = path.join(__dirname, '/fixtures/doiuse.config.json')
var overflowWrapCssFile = path.join(__dirname, '/cases/overflow-wrap.css')
var expectedOverflowWrapConfig = '<streaming css input>:7:1: CSS3 Overflow-wrap only partially supported by: IE (11) (wordwrap)\n'
exec(commands.doiuse + '-c ' + configFile + ' ' + overflowWrapCssFile, function (error, stdout, stderr) {
t.equal(stdout, expectedOverflowWrapConfig.replace(/<streaming css input>/g, overflowWrapCssFile))
t.end(error)
})
})

112
node_modules/doiuse/test/detect-feature-use.js generated vendored Normal file
View File

@@ -0,0 +1,112 @@
var fs = require('fs')
var path = require('path')
var test = require('tape')
var postcss = require('postcss')
var Detector = require('../lib/detect-feature-use')
/*
* Parse the feature-key: count lines in the leading comment of
* each test case fixture.
*/
var parseTestCase = function (cssString) {
var meta = /\s*\/\*(\s*only)?\s*expect:\s*([a-zA-Z0-9\-:\s\n]*)/
var matches = cssString.match(meta)
if (!matches) { return }
var features = {}
matches[2].split('\n')
.filter(function (s) {
return s.trim().length > 0
})
.forEach(function (s) {
var line = s.replace(/\s*/, '').split(':')
var feat = line[0]
var count = +line[1]
features[feat] = count
})
if (Object.keys(features).length > 0) {
return {
only: !!matches[1],
expected: features
}
} else {
return false
}
}
/**
* make a spy callback.
*
* spy functions save results from calls on `spyFn.results`.
*/
var spy = function () {
var results = []
var fn = function (param) {
var feature = param.feature
var usage = param.usage
var obj = {
feature: feature,
location: usage.source.start,
selector: usage.selector,
property: usage.property,
value: usage.value
}
if (results[feature]) {
results[feature]
} else {
results[feature] = []
}
return results[feature].push(obj)
}
fn.results = results
return fn
}
var runTest = function (tc, cssString, expected, only) {
var features = Object.keys(expected).sort()
var testFn = only ? test.only.bind(test) : test
testFn('detecting CSS features (' + tc.replace('.css', '') + ')', function (t) {
var detector = new Detector(features)
var cb = spy()
detector.process(postcss.parse(cssString), cb)
var res = Object.keys(cb.results).sort()
for (var feature in expected) {
if (expected[feature] === 0) {
t.notOk(cb.results[feature])
} else {
t.deepEqual(res, features)
t.equal(cb.results[feature].length, expected[feature], 'count of ' + feature)
}
}
t.end()
})
}
var caseFiles = fs.readdirSync(path.join(__dirname, '/cases'))
.filter(function (tc) { return /\.css$/.test(tc) })
var cases = []
for (var i = 0; i < caseFiles.length; ++i) {
var tc = caseFiles[i]
var cssString = fs.readFileSync(path.join(__dirname, 'cases', tc)).toString()
var parsed = parseTestCase(cssString)
if (parsed) {
var testCase = {
name: tc,
expected: parsed.expected,
cssString: cssString
}
cases.push(testCase)
}
}
cases.forEach(function (testCase) {
runTest(testCase.name, testCase.cssString, testCase.expected, cases.length === 1)
})

3
node_modules/doiuse/test/fixtures/doiuse.config.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"browsers": ["IE > 10"]
}

6
node_modules/doiuse/test/has-keys.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
module.exports = hasKeys
function hasKeys (t, object, keys) {
var objectKeys = Object.keys(object).sort()
var expectedKeys = [].concat(keys).sort()
return t.deepEqual(objectKeys, expectedKeys)
}

83
node_modules/doiuse/test/missing-support.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
var test = require('tape')
var missingSupport = require('../lib/missing-support')
var hasKeys = require('./has-keys')
test('provides list of selected browsers', function (t) {
var data
data = missingSupport(['ie >= 8'])
.browsers.sort(function (a, b) {
return Number(a[1]) - Number(b[1])
})
t.deepEqual(data, [
[
'ie',
'8'
],
[
'ie',
'9'
],
[
'ie',
'10'
],
[
'ie',
'11'
]
])
t.end()
})
test('for browser request ie >= 7, safari >= 6, opera >= 10.1', function (t) {
var data = missingSupport([
'ie >= 7',
'safari >= 6',
'opera >= 10.1'
]).features
var bgimgopts = data['background-img-opts']
hasKeys(t, bgimgopts, ['missing', 'partial', 'title', 'missingData', 'partialData', 'caniuseData'])
var missing = bgimgopts.missingData
var partial = bgimgopts.partialData
hasKeys(t, missing, ['ie'])
hasKeys(t, missing.ie, ['7', '8'])
hasKeys(t, partial, ['safari', 'opera'])
hasKeys(t, partial.safari, ['6', '6.1'])
hasKeys(t, partial.opera, ['10.0-10.1'])
t.end()
})
test('partialData only yields features partially supported by selected browser', function (t) {
var data, f, featureData, p
data = missingSupport(['ie 8']).features
var partial = []
for (p in data) {
if (data[p].partialData) {
partial.push(data[p])
}
}
for (f in partial) {
featureData = partial[f]
hasKeys(t, featureData.partialData, ['ie'])
}
t.end()
})
test('missingData only yields features not supported by selected browser', function (t) {
var data, f, featureData, m
data = missingSupport(['ie 8']).features
var missing = []
for (m in data) {
if (data[m].missingData) {
missing.push(data[m])
}
}
for (f in missing) {
featureData = missing[f]
hasKeys(t, featureData.missingData, ['ie'])
}
t.end()
})

139
node_modules/doiuse/test/postcss-plugin.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
var fs = require('fs')
var test = require('tape')
var postcss = require('postcss')
var doiuse = require('../')
var atImport = require('postcss-import')
var hasKeys = require('./has-keys')
test('leaves css alone by default', function (t) {
var css, out
css = fs.readFileSync(require.resolve('./cases/gradient.css')).toString()
out = postcss(doiuse({
browsers: [
'ie >= 7',
'safari >= 6',
'opera >= 10.1'
]
})).process(css).css
t.equal(out, css)
t.end()
})
test('calls back for unsupported feature usages', function (t) {
var count, css
css = fs.readFileSync(require.resolve('./cases/gradient.css'))
count = 0
postcss(doiuse({
browsers: ['ie 8'],
onFeatureUsage: function (usageInfo) {
count++
hasKeys(t, usageInfo, ['feature', 'featureData', 'usage', 'message'])
hasKeys(t, usageInfo.featureData, ['title', 'missing', 'missingData', 'caniuseData'])
}
}))
.process(css).then(function () {
t.equal(count, 4)
t.end()
})
})
test('ignores specified features and calls back for the others', function (t) {
var count, css
css = fs.readFileSync(require.resolve('./cases/gradient.css'))
count = 0
postcss(doiuse({
browsers: ['ie 8'],
ignore: [
'css-gradients'
],
onFeatureUsage: function (usageInfo) {
count++
hasKeys(t, usageInfo, ['feature', 'featureData', 'usage', 'message'])
hasKeys(t, usageInfo.featureData, ['title', 'missing', 'missingData', 'caniuseData'])
}
}))
.process(css).then(function () {
t.equal(count, 2)
t.end()
})
})
test('ignores specified files and calls back for others', function (t) {
var run, ignoreCss, processCss, pcss
ignoreCss = fs.readFileSync(require.resolve('./cases/ignore-file.css'))
processCss = fs.readFileSync(require.resolve('./cases/gradient.css'))
run = false
pcss = function () {
return postcss(doiuse({
browsers: ['ie 6'],
ignoreFiles: ['**/ignore-file.css'],
onFeatureUsage: function (usageInfo) {
run = true
}
}))
}
pcss().process(ignoreCss, {from: './cases/ignore-file.css'})
.then(function () {
t.false(run, 'should be false')
})
.then(function () {
return pcss().process(processCss, {from: './cases/gradient.css'})
})
.then(function () {
t.true(run, 'should be true')
t.end()
})
})
test('ignores rules from some imported files, and not others', function (t) {
var count, css, cssPath
cssPath = require.resolve('./cases/ignore-import.css')
css = fs.readFileSync(cssPath)
count = 0
postcss([atImport(),
doiuse({
browsers: ['ie 6'],
ignoreFiles: ['**/ignore-file.css'],
onFeatureUsage: function (usageInfo) {
count++
}
})])
.process(css, {from: cssPath})
.then(function () {
t.equal(count, 2)
t.end()
})
})
test('ignores rules specified in comments', function (t) {
var count, ignoreCss, ignoreCssPath, processCss, processCssPath
ignoreCssPath = require.resolve('./cases/ignore-comment.css')
ignoreCss = fs.readFileSync(ignoreCssPath)
processCssPath = require.resolve('./cases/ignore-file.css')
processCss = fs.readFileSync(processCssPath)
count = 0
var processor = postcss([atImport(),
doiuse({
browsers: ['ie 6'],
onFeatureUsage: function (usageInfo) {
count++
}
})])
processor.process(ignoreCss, {from: ignoreCssPath})
.then(function () {
t.equal(count, 2)
}).then(function () {
processor.process(processCss, {from: processCssPath})
.then(function () {
t.equal(count, 3, 'inline css disabing rules must apply only to current file')
t.end()
})
})
})

49
node_modules/doiuse/test/stream.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
var stream = require('../stream')
var through = require('through2')
var test = require('tape')
var expected = [
'css-sel3',
'background-img-opts'
]
var expectedWithIgnore = [
'background-img-opts'
]
test('streaming works', function (t) {
var s = stream({ browsers: 'IE >= 8' })
s.pipe(through.obj(function (usage, enc, next) {
t.equal(usage.feature, expected.shift())
next()
}, function (next) {
next()
t.equal(expected.length, 0)
t.end()
}))
s.end('div:nth-child(2n-1) { background-size: cover; }')
})
test('streaming works with ignore option', function (t) {
var s = stream({ browsers: 'IE >= 8', ignore: ['css-sel3'] })
s.pipe(through.obj(function (usage, enc, next) {
t.equal(usage.feature, expectedWithIgnore.shift())
next()
}, function (next) {
next()
t.equal(expectedWithIgnore.length, 0)
t.end()
}))
s.end('div:nth-child(2n-1) { background-size: cover; }')
})
test('gracefully emit error on bad browsers list', function (t) {
t.plan(1)
stream({ browsers: 'Blargh!' })
.on('error', function (e) {
t.ok(e)
})
})