update tests

pull/316/head
Rich Harris 8 years ago
parent 16e3574bfb
commit 543ee2f870

@ -1,9 +1,9 @@
import usesThisOrArguments from '../utils/usesThisOrArguments.js';
export default function onteardown ( validator, prop ) {
export default function ondestroy ( validator, prop ) {
if ( prop.value.type === 'ArrowFunctionExpression' ) {
if ( usesThisOrArguments( prop.value.body ) ) {
validator.error( `'onteardown' should be a function expression, not an arrow function expression`, prop.start );
validator.error( `'ondestroy' should be a function expression, not an arrow function expression`, prop.start );
}
}
}

@ -2,7 +2,7 @@
<script>
export default {
onrender () {
oncreate () {
this.isWidget = true;
}
};

@ -2,11 +2,11 @@
<script>
export default {
onrender () {
oncreate () {
this.events = [ 'render' ];
},
onteardown () {
ondestroy () {
this.events.push( 'teardown' );
}
};

@ -7,7 +7,7 @@
foo: 'XX'
};
},
onrender () {
oncreate () {
this.observe( 'item', item => {
this.set({ foo: item });
});

@ -2,7 +2,7 @@
<script>
export default {
onrender () {
oncreate () {
this.set({ inDocument: document.contains( this.refs.x ) })
}
};

@ -1,5 +1,5 @@
export default {
'skip-ssr': true, // uses onrender
'skip-ssr': true, // uses oncreate
html: `<div><p>true</p>\n<p>true</p></div>`
};

@ -2,7 +2,7 @@
<script>
export default {
onrender () {
oncreate () {
this.set({ inDocument: document.contains( this.refs.x ) })
}
};

@ -1,5 +1,5 @@
export default {
'skip-ssr': true, // uses onrender
'skip-ssr': true, // uses oncreate
html: `<div><p>true</p></div>`,

@ -2,7 +2,7 @@
<script>
export default {
onrender () {
oncreate () {
this.observe( 'foo', foo => {
const bar = this.get( 'bar' );
if ( foo.x !== bar.x ) throw new Error( 'mismatch' );

@ -11,7 +11,7 @@
}
},
onrender () {
oncreate () {
this.observe( 'foo', foo => {
this.set({ bar: foo });
});

@ -1,5 +1,5 @@
export default {
'skip-ssr': true, // uses onrender
'skip-ssr': true, // uses oncreate
html: `
<p>1</p>

@ -7,7 +7,7 @@
foo: 1
}),
onrender () {
oncreate () {
this.observe( 'foo', foo => {
this.set({ bar: foo * 2 });
});

@ -1,5 +1,5 @@
export default {
'skip-ssr': true, // uses onrender
'skip-ssr': true, // uses oncreate
html: '<p>2</p>'
};

@ -6,7 +6,7 @@
foo: 1
}),
onrender () {
oncreate () {
this.set({ foo: 2 });
}
};

@ -2,7 +2,7 @@
<script>
export default {
onrender () {
oncreate () {
console.log( 42 );
}
}

@ -0,0 +1,5 @@
<script>
export default {
oncreate: () => console.log( 'rendering' )
};
</script>

@ -1,5 +1,5 @@
[{
"message": "'onrender' should be a function expression, not an arrow function expression",
"message": "'oncreate' should be a function expression, not an arrow function expression",
"pos": 29,
"loc": {
"line": 3,

@ -1,6 +1,6 @@
<script>
export default {
onrender: () => {
oncreate: () => {
this.set({ a: 1 });
}
};

@ -0,0 +1,5 @@
<script>
export default {
ondestroy: () => console.log( 'tearing down' )
};
</script>

@ -0,0 +1,8 @@
[{
"message": "'ondestroy' should be a function expression, not an arrow function expression",
"pos": 29,
"loc": {
"line": 3,
"column": 2
}
}]

@ -1,6 +1,6 @@
<script>
export default {
onteardown: () => {
ondestroy: () => {
this.set({ a: 1 });
}
};

@ -1,5 +0,0 @@
<script>
export default {
onrender: () => console.log( 'rendering' )
};
</script>

@ -1,5 +0,0 @@
<script>
export default {
onteardown: () => console.log( 'tearing down' )
};
</script>

@ -1,8 +0,0 @@
[{
"message": "'onteardown' should be a function expression, not an arrow function expression",
"pos": 29,
"loc": {
"line": 3,
"column": 2
}
}]
Loading…
Cancel
Save