Skip to content

Commit 27b6dc2

Browse files
added: tests and travis hooks
1 parent c8690ae commit 27b6dc2

File tree

6 files changed

+74
-7
lines changed

6 files changed

+74
-7
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ jspm_packages
3535

3636
# Optional REPL history
3737
.node_repl_history
38+
39+
# generated files
40+
index.js

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: node_js
2+
node_js:
3+
- "6.*"
4+
5+
branches:
6+
only:
7+
- master
8+
9+
before_install:
10+
npm i rollup
11+
npm run build
12+
13+
notifications:
14+
email: false
15+
16+
sudo: false

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# bianco-query
2-
Modern DOM query selectors helpers written in es2015
32

4-
This script will not be transpiled and it is only thought to be part of your build chain.
3+
[![Build Status][travis-image]][travis-url]
4+
5+
[![NPM version][npm-version-image]][npm-url]
6+
[![NPM downloads][npm-downloads-image]][npm-url]
7+
[![MIT License][license-image]][license-url]
8+
9+
Modern DOM query selectors helpers written in es2015
510

611
## Usage
712

@@ -14,3 +19,14 @@ $('h1').forEach((h1) => console.log(h1.innerHTML))
1419
## API
1520

1621
- `$(selector|NodeList, context)` returns always an array of the elements found
22+
23+
24+
[travis-image]:https://img.shields.io/travis/GianlucaGuarini/bianco-query.svg?style=flat-square
25+
[travis-url]:https://travis-ci.org/GianlucaGuarini/bianco-query
26+
27+
[license-image]:http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
28+
[license-url]:LICENSE.txt
29+
30+
[npm-version-image]:http://img.shields.io/npm/v/bianco-query.svg?style=flat-square
31+
[npm-downloads-image]:http://img.shields.io/npm/dm/bianco-query.svg?style=flat-square
32+
[npm-url]:https://npmjs.org/package/bianco-query

index.js renamed to index.next.js

File renamed without changes.

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
"version": "0.0.0",
44
"description": "Modern DOM query selectors helpers written in es2015",
55
"main": "index.js",
6-
"jsnext:main": "index.js",
6+
"jsnext:main": "index.next.js",
77
"scripts": {
8-
"prepublish": "npm test",
9-
"test": "echo 'there will be soon'"
8+
"prepublish": "npm run build && npm test",
9+
"build": "rollup -f cjs -- index.next.js > index.js",
10+
"test": "node test"
1011
},
1112
"files": [
12-
"index.js"
13+
"index.js",
14+
"index.next.js"
1315
],
1416
"repository": {
1517
"type": "git",
@@ -29,5 +31,9 @@
2931
"bugs": {
3032
"url": "https://github.com/GianlucaGuarini/bianco-query/issues"
3133
},
32-
"homepage": "https://github.com/GianlucaGuarini/bianco-query#readme"
34+
"homepage": "https://github.com/GianlucaGuarini/bianco-query#readme",
35+
"devDependencies": {
36+
"jsdom": "9.5.0",
37+
"jsdom-global": "2.1.0"
38+
}
3339
}

test.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
require('jsdom-global')()
2+
const assert = require('assert')
3+
const $ = require('./')
4+
5+
function setup() {
6+
var div = document.createElement('div')
7+
8+
div.innerHTML = `
9+
<ul>
10+
<li class='item'></li>
11+
<li class='item'></li>
12+
</ul>
13+
`
14+
document.body.appendChild(div)
15+
}
16+
17+
setup()
18+
19+
const div = $('div')
20+
assert.equal(typeof div, 'object')
21+
assert.equal(div.length, 1)
22+
23+
assert.equal($('.item', div[0]).length, 2)
24+
25+
26+

0 commit comments

Comments
 (0)