|
284 | 284 | this._createMethodObserver('propChanged2(prop)');
|
285 | 285 | this.registeredCount++;
|
286 | 286 | this.registeredProps = [this.prop1, this.prop2, this.prop3];
|
287 |
| - this.registeredBehaviors = this.constructor.behaviors; |
| 287 | + this.registeredBehaviors = this.behaviors; |
288 | 288 | },
|
289 | 289 | prop1: true,
|
290 | 290 | ready: function() {
|
|
382 | 382 | assert.equal(el.__label, 'foo');
|
383 | 383 | });
|
384 | 384 |
|
| 385 | + test('instance behaviors', function() { |
| 386 | + assert.equal(el.behaviors.length, 1); |
| 387 | + }); |
| 388 | + |
385 | 389 | test('listener from behavior', function() {
|
386 | 390 | el.fire('change', {value: 'bar'});
|
387 | 391 | assert.equal(el.__change, 'bar');
|
|
413 | 417 | var el = fixture('registered');
|
414 | 418 | assert.equal(el.registeredCount, 4);
|
415 | 419 | assert.equal(el.registeredBehaviors.length, 3);
|
416 |
| - assert.equal(el.registeredBehaviors, el.constructor.behaviors); |
| 420 | + assert.equal(el.registeredBehaviors, el.behaviors); |
417 | 421 | assert.deepEqual(el.registeredProps, [true, true, true]);
|
418 | 422 | });
|
419 | 423 |
|
|
447 | 451 | assert.equal(el.__readyB, true);
|
448 | 452 | });
|
449 | 453 |
|
| 454 | + test('instance behaviors', function() { |
| 455 | + assert.equal(el.behaviors.length, 2); |
| 456 | + }); |
| 457 | + |
450 | 458 | test('properties from behaviors', function() {
|
451 | 459 | el.label = 'foo';
|
452 | 460 | assert.equal(el.__label, 'foo');
|
|
510 | 518 | test('behavior array is unique', function() {
|
511 | 519 | customElements.define('behavior-unique', Polymer.mixinBehaviors(
|
512 | 520 | [Polymer.BehaviorA, Polymer.BehaviorA], Polymer.Element));
|
513 |
| - assert.equal(document.createElement('behavior-unique').constructor.behaviors.length, 1); |
| 521 | + assert.equal(document.createElement('behavior-unique').behaviors.length, 1); |
514 | 522 | });
|
515 | 523 |
|
516 | 524 | test('duplicate behaviors keep first behavior', function() {
|
517 | 525 | customElements.define('behavior-unique-last-behavior', Polymer.mixinBehaviors(
|
518 | 526 | [Polymer.BehaviorA, Polymer.BehaviorB, Polymer.BehaviorC, Polymer.BehaviorA, Polymer.BehaviorB], Polymer.Element));
|
519 |
| - var behaviors = document.createElement('behavior-unique-last-behavior').constructor.behaviors; |
| 527 | + var behaviors = document.createElement('behavior-unique-last-behavior').behaviors; |
520 | 528 | assert.deepEqual(behaviors, [Polymer.BehaviorC, Polymer.BehaviorA, Polymer.BehaviorB]);
|
521 | 529 | });
|
522 | 530 |
|
|
530 | 538 | });
|
531 | 539 |
|
532 | 540 | test('nested-behavior dedups', function() {
|
533 |
| - assert.equal(el.constructor.behaviors.length, 4); |
| 541 | + assert.equal(el.behaviors.length, 4); |
534 | 542 | });
|
535 | 543 |
|
536 | 544 | test('nested-behavior overrides ordering', function() {
|
|
0 commit comments