mirror of
https://github.com/thangisme/notes.git
synced 2026-06-14 00:29:31 -04:00
Initial commit
This commit is contained in:
49
node_modules/doiuse/test/stream.js
generated
vendored
Normal file
49
node_modules/doiuse/test/stream.js
generated
vendored
Normal 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)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user