|
50 | 50 | },
|
51 | 51 | computedMulti: {
|
52 | 52 | computed: 'computeMulti(computedMultiDep1, computedMultiDep2)'
|
53 |
| - } |
| 53 | + }, |
| 54 | + wildcardProp: String, |
| 55 | + wildcardObj: Object |
54 | 56 | },
|
55 | 57 | observers: [
|
56 | 58 | 'staticObserver("staticObserver")',
|
57 | 59 | 'singlePropObserver(singleProp)',
|
58 | 60 | 'multiPropObserver(multiProp1, multiProp2)',
|
59 |
| - 'throws(throwProp)' |
| 61 | + 'throws(throwProp)', |
| 62 | + 'wildcardObserver(wildcardProp, wildcardObj.*)' |
60 | 63 | ],
|
61 | 64 | created() {
|
62 | 65 | this.singlePropObserver = sinon.spy();
|
63 | 66 | this.multiPropObserver = sinon.spy();
|
64 | 67 | this.staticObserver = sinon.spy();
|
65 | 68 | this.computeSingle = sinon.spy((inlineSingleDep) => `[${inlineSingleDep}]`);
|
66 | 69 | this.computeMulti = sinon.spy((inlineMultiDep1, inlineMultiDep2) => `[${inlineMultiDep1},${inlineMultiDep2}]`);
|
| 70 | + this.wildcardObserver = sinon.spy(); |
67 | 71 | },
|
68 | 72 | throws() {
|
69 | 73 | throw new Error('real error');
|
|
145 | 149 | </template>
|
146 | 150 | </test-fixture>
|
147 | 151 |
|
| 152 | + <test-fixture id="declarative-wildcard-one"> |
| 153 | + <template> |
| 154 | + <x-data wildcard-prop='prop'></x-data> |
| 155 | + </template> |
| 156 | + </test-fixture> |
| 157 | + |
| 158 | + <test-fixture id="declarative-wildcard-all"> |
| 159 | + <template> |
| 160 | + <x-data wildcard-prop="prop" wildcard-obj='{"prop": "wildcardObj"}'></x-data> |
| 161 | + </template> |
| 162 | + </test-fixture> |
| 163 | + |
148 | 164 | <script>
|
149 | 165 | (function() {
|
150 | 166 |
|
|
192 | 208 | const inlineMultiDep2 = 'inlineMultiDep2';
|
193 | 209 | const inlineMultiIfDep1 = 'inlineMultiIfDep1';
|
194 | 210 | const inlineMultiIfDep2 = 'inlineMultiIfDep2';
|
| 211 | + const wildcardProp = 'wildcardProp'; |
| 212 | + const wildcardObj = {prop: 'wildcardObj'}; |
195 | 213 |
|
196 | 214 | suite('check disabled', () => {
|
197 | 215 | test('no arguments defined', () => {
|
|
270 | 288 | assertEffects({computeMulti: 1});
|
271 | 289 | assert.equal(el.$$('#ifChild').computedMulti, '[inlineMultiIfDep1,inlineMultiIfDep2]');
|
272 | 290 | });
|
| 291 | + test('one wildcard argument defined', () => { |
| 292 | + setupElement(false, {wildcardProp}); |
| 293 | + assertEffects({wildcardObserver: 1}); |
| 294 | + }); |
| 295 | + test('all wildcard arguments defined', () => { |
| 296 | + setupElement(false, {wildcardProp, wildcardObj}); |
| 297 | + assertEffects({wildcardObserver: 1}); |
| 298 | + }); |
273 | 299 | });
|
274 | 300 |
|
275 | 301 | suite('warn', () => {
|
|
349 | 375 | assertEffects({computeMulti: 1});
|
350 | 376 | assert.equal(el.$$('#ifChild').computedMulti, '[inlineMultiIfDep1,inlineMultiIfDep2]');
|
351 | 377 | });
|
| 378 | + test('one wildcard argument defined', () => { |
| 379 | + setupElement(true, {wildcardProp}); |
| 380 | + assertEffects({warn: 1}); |
| 381 | + }); |
| 382 | + test('all wildcard arguments defined', () => { |
| 383 | + setupElement(true, {wildcardProp, wildcardObj}); |
| 384 | + assertEffects({wildcardObserver: 1}); |
| 385 | + }); |
352 | 386 | });
|
353 | 387 | });
|
354 | 388 |
|
|
416 | 450 | assertEffects({computeMulti: 1});
|
417 | 451 | assert.equal(el.$$('#ifChild').computedMulti, '[b,c]');
|
418 | 452 | });
|
| 453 | + test('one wildcard argument defined', () => { |
| 454 | + el = fixture('declarative-wildcard-one'); |
| 455 | + Polymer.flush(); |
| 456 | + assertEffects({warn: 1}); |
| 457 | + }); |
| 458 | + test('all wildcard arguments defined', () => { |
| 459 | + el = fixture('declarative-wildcard-all'); |
| 460 | + Polymer.flush(); |
| 461 | + assertEffects({wildcardObserver: 1}); |
| 462 | + }); |
419 | 463 | });
|
420 | 464 | });
|
421 | 465 |
|
|
0 commit comments