Skip to content

Commit

Permalink
restored some tests and updated build tools
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Hayes committed Nov 30, 2015
1 parent 393c1de commit 55cffc4
Show file tree
Hide file tree
Showing 6 changed files with 361 additions and 150 deletions.
228 changes: 116 additions & 112 deletions dist/altr.js

Large diffs are not rendered by default.

128 changes: 128 additions & 0 deletions dist/altr.min.js

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions dist/altr.min.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/altr.min.map

This file was deleted.

24 changes: 8 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"lint": "eslint .",
"test": "npm run lint && node test | faucet && browserify test -d | jsdom-eval | faucet",
"build": "mkdir -p dist; npm run build-debug; npm run build-min",
"build-debug": "browserify lib/browser.js --debug -x ./node_modules/micro-dom > dist/altr.js",
"build-min": "browserify lib/browser.js --debug -x ./node_modules/micro-dom -p [minifyify --output dist/altr.min.map --map altr.min.map] > dist/altr.min.js",
"build-debug": "browserify lib/browser.js --debug > dist/altr.js",
"build-min": "browserify lib/browser.js --debug -g uglifyify | exorcist dist/altr.min.js.map > dist/altr.min.js",
"docs": "cd docs && hugo server --watch --buildDrafts",
"docs-win": ".\\docs\\hugo.exe server --watch --buildDrafts"
},
Expand All @@ -21,26 +21,18 @@
"dependencies": {
"batch-queue": "0.0.2",
"dirtybit": "^1.0.1",
"exorcist": "^0.4.0",
"extend": "^1.3.0",
"faucet": "0.0.1",
"jsdom-eval": "^0.2.3",
"micro-dom": "0.0.17",
"tape": "^3.4.0"
"micro-dom": "0.0.17"
},
"devDependencies": {
"altr-ease": "0.0.3",
"altr-scale": "0.0.0",
"browserify": "^4.1.11",
"concat-stream": "1.4.4",
"ease-component": "1.0.0",
"eslint": "^1.10.2",
"eslint-config-standard": "^4.4.0",
"eslint-plugin-standard": "^1.3.1",
"exorcist": "0.1.5",
"highlight.js": "8.0.0",
"marked": "0.3.2",
"minifyify": "^3.0.9",
"tape": "2.12.3"
"faucet": "0.0.1",
"jsdom-eval": "^0.2.5",
"tape": "^4.2.2",
"uglifyify": "^3.0.1"
},
"readmeFilename": "README.md",
"bugs": {
Expand Down
41 changes: 20 additions & 21 deletions test/tags/for.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ test('nested fors', function (t) {
t.equal(
template.toString(),
'<ul altr-for="o in out"><ul altr-for="i in in">a1a2</ul>' +
'<ul altr-for="i in in">b1b2</ul></ul>'
'<ul altr-for="i in in">b1b2</ul></ul>'
)
})
/*
test('for respects placeholder', function(t) {

test('for respects placeholder', function (t) {
var template = altr(
'<ul altr-for="item in items"><li altr-if="show">{{ item }}</li></ul>',
{show: true, items: [1,2,3]},
{show: true, items: [1, 2, 3]},
{sync: true}
)

Expand All @@ -69,62 +69,61 @@ test('for respects placeholder', function(t) {
'<li altr-if="show">2</li><li altr-if="show">3</li></ul>'
)

template.update({show: false, items: [3,2,1]})
template.update({show: false, items: [3, 2, 1]})
t.equal(
template.toString(),
'<ul altr-for="item in items"><!--altr-if-placeholder-->' +
'<!--altr-if-placeholder--><!--altr-if-placeholder--></ul>'
'<!--altr-if-placeholder--><!--altr-if-placeholder--></ul>'
)

template.update({show: true, items: [3,2,1]})
template.update({show: true, items: [3, 2, 1]})
t.equal(
template.toString(),
'<ul altr-for="item in items"><li altr-if="show">3</li>' +
'<li altr-if="show">2</li><li altr-if="show">1</li></ul>'
'<li altr-if="show">2</li><li altr-if="show">1</li></ul>'
)

template.update({show: true, items: [1,2,3]})
template.update({show: true, items: [1, 2, 3]})
t.equal(
template.toString(),
'<ul altr-for="item in items"><li altr-if="show">1</li>' +
'<li altr-if="show">2</li><li altr-if="show">3</li></ul>'
'<li altr-if="show">2</li><li altr-if="show">3</li></ul>'
)
})

test('adding and removing', function(t) {
test('adding and removing', function (t) {
var template = altr(
'<ul altr-for="item in items"><li altr-if="show">{{ item }}</li></ul>',
{show: true, items: [1,2,3]},
{show: true, items: [1, 2, 3]},
{sync: true}
)

t.plan(4)
t.equal(
template.toString(),
'<ul altr-for="item in items"><li altr-if="show">1</li>' +
'<li altr-if="show">2</li><li altr-if="show">3</li></ul>'
'<li altr-if="show">2</li><li altr-if="show">3</li></ul>'
)

template.update({show: false, items: [4,3,2,1]})
template.update({show: false, items: [4, 3, 2, 1]})
t.equal(
template.toString(),
'<ul altr-for="item in items"><!--altr-if-placeholder-->' +
'<!--altr-if-placeholder--><!--altr-if-placeholder-->' +
'<!--altr-if-placeholder--></ul>'
'<!--altr-if-placeholder--><!--altr-if-placeholder-->' +
'<!--altr-if-placeholder--></ul>'
)

template.update({show: true, items: [3,4,1]})
template.update({show: true, items: [3, 4, 1]})
t.equal(
template.toString(),
'<ul altr-for="item in items"><li altr-if="show">3</li>' +
'<li altr-if="show">4</li><li altr-if="show">1</li></ul>'
'<li altr-if="show">4</li><li altr-if="show">1</li></ul>'
)

template.update({show: true, items: [4,5,6]})
template.update({show: true, items: [4, 5, 6]})
t.equal(
template.toString(),
'<ul altr-for="item in items"><li altr-if="show">4</li>' +
'<li altr-if="show">5</li><li altr-if="show">6</li></ul>'
'<li altr-if="show">5</li><li altr-if="show">6</li></ul>'
)
})
*/

0 comments on commit 55cffc4

Please sign in to comment.