Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tabs): fix an invoke of select event outside of tabs (#3755) #5002

Merged
merged 6 commits into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ env:
- BROWSER_PROVIDER_READY_FILE=/tmp/sauce-connect-ready
- LOGS_DIR=/tmp/logs
- CY_KEY=4aa7a1c0-3a4f-444e-b324-6fc305a543a8
- NPM_AUTH_TOKEN_CI_PR=810c9089-b5e8-4348-8c89-61a1c2461d68

# test cypress smoke
testSmokeCy: &testSmokeCy
Expand Down Expand Up @@ -81,6 +82,7 @@ jobs:
- npm ci
- npm run build
- npm run ci:update-pkg
- if [[ "$TRAVIS_PULL_REQUEST" != false ]]; then export NPM_AUTH_TOKEN_CI=$NPM_AUTH_TOKEN_CI_PR; fi
- npm config set '//registry.npmjs.org/:_authToken' $NPM_AUTH_TOKEN_CI
- cd dist
- npm publish --tag $TRAVIS_COMMIT
Expand Down Expand Up @@ -136,7 +138,7 @@ jobs:
- npm config set '//registry.npmjs.org/:_authToken' $NPM_AUTH_TOKEN_CI
- npm unpublish --tag $TRAVIS_COMMIT --force

# deploy to ngx-bootstrap.surge.sh
# deploy to ngx-bootstrap.surge.sh
- &surge
stage: deploy
script: npm run demo.build
Expand All @@ -159,7 +161,7 @@ jobs:
project: ./gh-pages/
domain: ngx-bootstrap-next.surge.sh
on: development
# deploy to ngx-universal.herokuapp.com/
# deploy to ngx-universal.herokuapp.com/
- stage: deploy
script: npm run build:dynamic
before_deploy:
Expand Down
2 changes: 1 addition & 1 deletion demo/src/app/components/+tabs/demos/dynamic/dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<tab *ngFor="let tabz of tabs"
[heading]="tabz.title"
[active]="tabz.active"
(select)="tabz.active = true"
(selectTab)="tabz.active = true"
(deselect)="tabz.active = false"
[disabled]="tabz.disabled"
[removable]="tabz.removable"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<pre class="card card-block card-header" *ngIf="value">Event select is fired. The heading of the selected tab is: {{value}}</pre>
</div>
<tabset>
<tab heading="First tab" class="mt-2" (select)="onSelect($event)">
<tab heading="First tab" class="mt-2" (selectTab)="onSelect($event)">
<h4>Title</h4>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</tab>
<tab heading="Second tab" class="mt-2" (select)="onSelect($event)">
<tab heading="Second tab" class="mt-2" (selectTab)="onSelect($event)">
<h4>Title 2</h4>
<p>It has survived not only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It was popularised in the 1960s with the release of
Expand Down
4 changes: 2 additions & 2 deletions demo/src/ng-api-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2918,8 +2918,8 @@ export const ngdoc: any = {
"description": "<p>fired before tab will be removed, $event:Tab equals to instance of removed tab</p>\n"
},
{
"name": "select",
"description": "<p>fired when tab became active, $event:Tab equals to selected instance of Tab component</p>\n"
"name": "selectTab",
"description": "<p>fired when tab became active, $event:Tab equals to selected instance of Tab component </p>\n"
}
],
"properties": [],
Expand Down
2 changes: 1 addition & 1 deletion src/spec/tabset.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const html = `
[customClass]="tab.customClass"
[active]="tab.active"
[removable]="tab.removable"
(select)="_select($event)"
(selectTab)="_select($event)"
(deselect)="_deselect($event)"
(removed)="_removed($event)"
[heading]="tab.title">{{ tab.content }}</tab>
Expand Down
4 changes: 2 additions & 2 deletions src/tabs/tab.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class TabDirective implements OnInit, OnDestroy {
}

this._active = active;
this.select.emit(this);
this.selectTab.emit(this);
this.tabset.tabs.forEach((tab: TabDirective) => {
if (tab !== this) {
tab.active = false;
Expand All @@ -75,7 +75,7 @@ export class TabDirective implements OnInit, OnDestroy {
}

/** fired when tab became active, $event:Tab equals to selected instance of Tab component */
@Output() select: EventEmitter<TabDirective> = new EventEmitter();
@Output() selectTab: EventEmitter<TabDirective> = new EventEmitter();
/** fired when tab became inactive, $event:Tab equals to deselected instance of Tab component */
@Output() deselect: EventEmitter<TabDirective> = new EventEmitter();
/** fired before tab will be removed, $event:Tab equals to instance of removed tab */
Expand Down