Skip to content

Commit

Permalink
wip test
Browse files Browse the repository at this point in the history
  • Loading branch information
syarul committed Aug 21, 2018
1 parent ed03ac0 commit 272aaa7
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
20 changes: 9 additions & 11 deletions README.md
Expand Up @@ -111,14 +111,15 @@ class App extends Keet {
const app = new App()

app.mount(html`
<button id="toggle" k-click="toggle()">toggle</button>
<button id="toggle" k-click="toggle()" attr="{{show?foo:bar}}" style="color: {{show?red:blue}};" {{show?testme:test}}>toggle</button>
<div id="1">one</div>
<!-- {{?show}} -->
<div id="2">two</div>
<!-- {{/show}} -->
<div id="3">three</div>
<div id="4">four</div>
<!-- {{/show}} -->
<div id="5">five</div>
`).link('app')

```
<!-- AUTO-GENERATED-CONTENT:END -->

Expand All @@ -132,13 +133,13 @@ To map an array to elements use the ```{{model:<myModelName>}}<myModelTemplate>{
<!-- AUTO-GENERATED-CONTENT:START (MODEL) -->
```js
import Keet from 'keet'
import { html, createModel } from 'keet/utils'
import { html, createModel as CreateModel } from 'keet/utils'

let task = new createModel()
let task = new CreateModel()

class App extends Keet {
task = task
componentWillMount(){
componentWillMount () {
// callBatchPoolUpdate - custom method to inform changes in the model.
// If the component has other states that reflect the model value changes
// we can safely ignore calling this method.
Expand Down Expand Up @@ -167,7 +168,7 @@ for (let i = 0; i < taskName.length; i++) {
app.task.add({
id: i,
taskName: taskName[i],
complete: i % 2 === 0 ? false : true
complete: i % 2 !== 0
})
}

Expand All @@ -178,10 +179,7 @@ app.task.update('id', {
complete: true
})

// remove a task
app.task.destroy('taskName', 'roll')

console.log(app)
```
<!-- AUTO-GENERATED-CONTENT:END -->

Expand Down Expand Up @@ -218,7 +216,7 @@ const app = new App()
app.mount(html`
<div id="container">
<div>parent</div>
{{component:subc}}
<!-- {{component:subc}} -->
</div>
`).link('app')

Expand Down
2 changes: 1 addition & 1 deletion examples/counter.js
@@ -1,4 +1,4 @@
/* global Event */
/* global Event */ // rem
import Keet from '../'
import { html, getId } from '../utils'

Expand Down
2 changes: 1 addition & 1 deletion examples/model.js
Expand Up @@ -23,7 +23,7 @@ const app = new App()
let name = 'myModel' // rem
// rem
app.mount(html`
<h1>${name}</h1><!-- //rem -->
<h1>${name}</h1><!-- // rem -->
<ul id="list">
<!-- {{model:task}} -->
<li id="{{id}}">
Expand Down
8 changes: 4 additions & 4 deletions keet-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion keet-min.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions keet.js
@@ -1,3 +1,4 @@

/**
* Keetjs v4.0.0 Alpha release: https://github.com/keetjs/keet
* Minimalist view layer for the web
Expand All @@ -13,8 +14,8 @@ import { updateContext, morpher } from './src/components/genElement'
import { genId, assert, html, createModel } from './utils'
import mount from './src/base/mount'

window.l = console.log.bind(console)
window.tr = console.trace.bind(console)
// window.l = console.log.bind(console)
// window.tr = console.trace.bind(console)

/**
* @description
Expand Down
4 changes: 3 additions & 1 deletion markdown.config.js
Expand Up @@ -75,7 +75,7 @@ function next(i, files){
parse[file] = ''

rd.on('line', function (line) {
if(!line.match('//rem')){
if(!line.match('// rem')){
if(line.match(/\.\.\/\'/g)){
line = line.replace(/\.\.\/\'/, 'keet\'')
} else if(line.match(/\.\.\/utils/g)){
Expand Down Expand Up @@ -120,7 +120,9 @@ function ReadLine2 (file) {
c++
if (c > 0 && c < 11) {
info += line + '\n'

if (c === 10) {
console.log(info)
var data = fs.readFileSync('./keet-min.js'); //read existing contents into data
var fd = fs.openSync('./keet-min.js', 'w+');
var buffer = new Buffer(info);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -81,7 +81,7 @@
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"start": "webpack-dev-server -d",
"test": "mocha test/test.js --require babel-core/register --require jsdom-global/register --timeout 10000",
"test-ci": "nyc npm run test",
"test-ci": "nyc npm run test && npm run lint",
"lint": "standard keet.js utils.js src/**/*.js examples/**/*.js --fix"
},
"git_branch": "master",
Expand Down

0 comments on commit 272aaa7

Please sign in to comment.