Skip to content

Commit

Permalink
Merge branch 'master' into feature/NEOV-198-template-support
Browse files Browse the repository at this point in the history
  • Loading branch information
nomego authored May 24, 2018
2 parents 6bbe4d6 + b0c567e commit e6ffcdb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cosmoz-tabbable-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@
if (index > -1) {
this.debounce('select-resize', this.notifyResize);

if (!item._previouslySelected) {
if (!item.isActive) {
this.fire('tab-first-select', {}, opts);
item._previouslySelected = true;
item.isActive = true;
}
this.fire('tab-select', {}, opts);
}
Expand Down
14 changes: 14 additions & 0 deletions cosmoz-tabbed-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@
observer: '_animatedSelectedChanged'
},

/**
* Is true when the item has been selected at least once.
*/
isActive: {
type: Boolean,
value: false,
reflectToAttribute: true,
notify: true
},

/**
* Accordion mode element state, true if it is in accordion mode.
* Should be forwarded by a `Cosmoz.TabbableBehavior` ancestor
Expand Down Expand Up @@ -107,6 +117,10 @@
this._onSelectedTransitionEnd = this._onSelectedTransitionEnd.bind(this);
},

detached() {
this.isActive = false;
},

get animated() {
return this.accordion;
},
Expand Down
4 changes: 4 additions & 0 deletions test/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
assert.equal(tabs.selectedAttribute, 'is-selected');
});

test('first tab isActive', () => {
assert.isTrue(tabs.items[0].isActive);
});

test('not accordion', () => {
assert.isFalse(tabs.accordion);
});
Expand Down

0 comments on commit e6ffcdb

Please sign in to comment.