@@ -127,7 +127,7 @@ const tests = [
127
127
{
128
128
name : 'Generic input[type="checkbox"] vModel' ,
129
129
from : `const A = <input type="checkbox" vModel={a.b} />` ,
130
- to : `const A = <input type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, null) > -1 : a.b} on-change={$event => {
130
+ to : `const A = <input on-change={$event => {
131
131
const $$a = a.b,
132
132
$$el = $event.target,
133
133
$$c = $$el.checked ? true : false;
@@ -144,7 +144,7 @@ const tests = [
144
144
} else {
145
145
a.b = $$c;
146
146
}
147
- }} {...{
147
+ }} type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, null) > -1 : a.b} {...{
148
148
directives: [{
149
149
name: "model",
150
150
value: a.b,
@@ -155,7 +155,7 @@ const tests = [
155
155
{
156
156
name : 'input[type="checkbox"] vModel_number' ,
157
157
from : `const A = <input type="checkbox" vModel_number={a.b} />` ,
158
- to : `const A = <input type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, null) > -1 : a.b} on-change={$event => {
158
+ to : `const A = <input on-change={$event => {
159
159
const $$a = a.b,
160
160
$$el = $event.target,
161
161
$$c = $$el.checked ? true : false;
@@ -172,7 +172,7 @@ const tests = [
172
172
} else {
173
173
a.b = $$c;
174
174
}
175
- }} {...{
175
+ }} type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, null) > -1 : a.b} {...{
176
176
directives: [{
177
177
name: "model",
178
178
value: a.b,
@@ -185,7 +185,7 @@ const tests = [
185
185
{
186
186
name : 'input[type="checkbox"] vModel with value, trueValue and falseValue' ,
187
187
from : `const A = <input type="checkbox" vModel={a.b} value="abc" trueValue={trueVal} falseValue={falseVal} />` ,
188
- to : `const A = <input type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, "abc") > -1 : this._q(a.b, trueVal)} on-change={$event => {
188
+ to : `const A = <input on-change={$event => {
189
189
const $$a = a.b,
190
190
$$el = $event.target,
191
191
$$c = $$el.checked ? trueVal : falseVal;
@@ -202,7 +202,7 @@ const tests = [
202
202
} else {
203
203
a.b = $$c;
204
204
}
205
- }} {...{
205
+ }} type="checkbox" domProps-checked={Array.isArray(a.b) ? this._i(a.b, "abc") > -1 : this._q(a.b, trueVal)} {...{
206
206
directives: [{
207
207
name: "model",
208
208
value: a.b,
@@ -213,9 +213,9 @@ const tests = [
213
213
{
214
214
name : 'Generic input[type="radio"] vModel' ,
215
215
from : `const A = <input type="radio" vModel={a.b} />` ,
216
- to : `const A = <input type="radio" domProps-checked={this._q(a.b, null)} on-change={$event => {
216
+ to : `const A = <input on-change={$event => {
217
217
a.b = null;
218
- }} {...{
218
+ }} type="radio" domProps-checked={this._q(a.b, null)} {...{
219
219
directives: [{
220
220
name: "model",
221
221
value: a.b,
@@ -226,9 +226,9 @@ const tests = [
226
226
{
227
227
name : 'input[type="radio"] vModel_number' ,
228
228
from : `const A = <input type="radio" vModel_number={a.b} value="10" />` ,
229
- to : `const A = <input type="radio" domProps-checked={this._q(a.b, this._n("10"))} on-change={$event => {
229
+ to : `const A = <input on-change={$event => {
230
230
a.b = this._n("10");
231
- }} {...{
231
+ }} type="radio" domProps-checked={this._q(a.b, this._n("10"))} {...{
232
232
directives: [{
233
233
name: "model",
234
234
value: a.b,
@@ -241,10 +241,10 @@ const tests = [
241
241
{
242
242
name : 'Generic input[type="text"] vModel' ,
243
243
from : `const A = <input type="text" vModel={a.b} />` ,
244
- to : `const A = <input type="text" domProps-value={a.b} on-input={$event => {
244
+ to : `const A = <input on-input={$event => {
245
245
if ($event.target.composing) return;
246
246
a.b = $event.target.value;
247
- }} {...{
247
+ }} type="text" domProps-value={a.b} {...{
248
248
directives: [{
249
249
name: "model",
250
250
value: a.b,
@@ -255,10 +255,10 @@ const tests = [
255
255
{
256
256
name : 'Generic textarea vModel' ,
257
257
from : `const A = <textarea vModel={a.b} />` ,
258
- to : `const A = <textarea domProps-value={a.b} on-input={$event => {
258
+ to : `const A = <textarea on-input={$event => {
259
259
if ($event.target.composing) return;
260
260
a.b = $event.target.value;
261
- }} {...{
261
+ }} domProps-value={a.b} {...{
262
262
directives: [{
263
263
name: "model",
264
264
value: a.b,
@@ -269,11 +269,11 @@ const tests = [
269
269
{
270
270
name : 'input[type="text"] vModel_lazy_trim_number' ,
271
271
from : `const A = <input type="text" vModel_lazy_trim_number={a.b} />` ,
272
- to : `const A = <input type="text" domProps-value={a.b} on-change={$event => {
273
- a.b = this._n($event.target.value.trim());
274
- }} on-blur={$event => {
272
+ to : `const A = <input on-blur={$event => {
275
273
this.$forceUpdate();
276
- }} {...{
274
+ }} on-change={$event => {
275
+ a.b = this._n($event.target.value.trim());
276
+ }} type="text" domProps-value={a.b} {...{
277
277
directives: [{
278
278
name: "model",
279
279
value: a.b,
@@ -288,14 +288,28 @@ const tests = [
288
288
{
289
289
name : 'input[type="range"] vModel' ,
290
290
from : `const A = <input type="range" vModel={a.b} />` ,
291
- to : `const A = <input type="range" domProps-value={a.b} on-__r={$event => {
291
+ to : `const A = <input on-__r={$event => {
292
292
a.b = $event.target.value;
293
- }} {...{
293
+ }} type="range" domProps-value={a.b} {...{
294
294
directives: [{
295
295
name: "model",
296
296
value: a.b,
297
297
modifiers: {}
298
298
}]
299
+ }} />;` ,
300
+ } ,
301
+ {
302
+ name : 'event listener added before other listeners' ,
303
+ from : `const A = <input onInput={this.someMethod} vModel={this.model} />` ,
304
+ to : `const A = <input on-input={$event => {
305
+ if ($event.target.composing) return;
306
+ this.model = $event.target.value;
307
+ }} onInput={this.someMethod} domProps-value={this.model} {...{
308
+ directives: [{
309
+ name: "model",
310
+ value: this.model,
311
+ modifiers: {}
312
+ }]
299
313
}} />;` ,
300
314
} ,
301
315
]
0 commit comments