-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding click handler to open tooltip (#1057)
- Loading branch information
Showing
9 changed files
with
136 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
describe('Large Format Dialog', () => { | ||
describe('Tooltips', () => { | ||
before(() => { | ||
cy.visit('/tooltip'); | ||
cy.get('.page-loader').should('not.exist', { timeout: 20000 }); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.get('ngx-section [ngx-tooltip]').first().as('CUT'); | ||
describe('Tooltip', () => { | ||
beforeEach(() => { | ||
cy.get('ngx-section [ngx-tooltip]').first().as('CUT'); | ||
}); | ||
|
||
it('should show tooltip', () => { | ||
cy.get('@CUT').whileHovering(() => { | ||
cy.root().closest('body').find('ngx-tooltip-content').should('exist'); | ||
cy.root().closest('body').find('ngx-tooltip-content').should('contain.text', 'Phishing Attack'); | ||
}); | ||
cy.get('ngx-tooltip-content').should('exist'); | ||
}); | ||
}); | ||
|
||
it('should show tooltip', () => { | ||
cy.get('@CUT').whileHovering(() => { | ||
cy.root().closest('body').find('ngx-tooltip-content').should('exist'); | ||
cy.root().closest('body').find('ngx-tooltip-content').should('contain.text', 'Phishing Attack'); | ||
describe('Tooltip - Popover click', () => { | ||
it('should toggle on click', () => { | ||
cy.dataCy('popover-click').as('BUTTON'); | ||
cy.get('@BUTTON').scrollIntoView(); | ||
cy.get('@BUTTON').whileHovering(() => { | ||
// should not be visible on-hover | ||
cy.root().closest('body').get('.popover-custom').should('not.exist'); | ||
}); | ||
cy.get('@BUTTON').click(); | ||
// should be visible on first click | ||
cy.get('.popover-custom').should('exist'); | ||
cy.get('@BUTTON').click(); | ||
// should no be visible on second click | ||
cy.root().find('.popover-custom').should('not.exist'); | ||
}); | ||
cy.get('ngx-tooltip-content').should('exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
projects/swimlane/ngx-ui/src/lib/components/tooltip/show-types.enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export enum ShowTypes { | ||
all = 'all', | ||
focus = 'focus', | ||
click = 'click', | ||
mouseover = 'mouseover' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { SectionModule, TabsModule, TooltipModule } from '@swimlane/ngx-ui'; | ||
import { DropdownModule, SectionModule, TabsModule, TooltipModule } from '@swimlane/ngx-ui'; | ||
import { PrismModule } from '../../common/prism/prism.module'; | ||
|
||
import { TooltipPageRoutingModule } from './tooltip-page-routing.module'; | ||
import { TooltipPageComponent } from './tooltip-page.component'; | ||
|
||
@NgModule({ | ||
declarations: [TooltipPageComponent], | ||
imports: [CommonModule, PrismModule, SectionModule, TooltipModule, TooltipPageRoutingModule, TabsModule] | ||
imports: [ | ||
CommonModule, | ||
PrismModule, | ||
SectionModule, | ||
TooltipModule, | ||
TooltipPageRoutingModule, | ||
TabsModule, | ||
DropdownModule | ||
] | ||
}) | ||
export class TooltipPageModule {} |