-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d490dba
commit 98eec25
Showing
15 changed files
with
5,618 additions
and
5,143 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 |
---|---|---|
|
@@ -5,7 +5,7 @@ addons: | |
|
||
language: node_js | ||
node_js: | ||
- node | ||
- lts/* | ||
|
||
branches: | ||
only: | ||
|
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
video: false, | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require('./cypress/plugins/index.js')(on, config) | ||
}, | ||
baseUrl: 'http://localhost:4200', | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
158 changes: 79 additions & 79 deletions
158
cypress/integration/date-picker.spec.ts → cypress/e2e/date-picker.cy.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,79 +1,79 @@ | ||
describe('date-picker tests', () => { | ||
before(() => { | ||
cy.visit(''); | ||
}); | ||
|
||
it('should show initial state', () => { | ||
cy.get('#date-picker8') | ||
.should('have.value', '01/24/2018') | ||
.should('have.attr', 'readonly'); | ||
cy.get('#date8').should('have.text', JSON.stringify(new Date(2018, 0, 24))); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should click input and open', () => { | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should click icon and open', () => { | ||
cy.get('#date-picker > date-picker > .input-group > .btn').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('#date-picker > date-picker > .input-group > .btn').click(); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should click outside and close', () => { | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('#date8').click({force: true}); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should change date when click on Jan 18', () => { | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('date-picker .custom-day').then((days) => { | ||
// should show correct number of days | ||
expect(days.length).to.be.equal(42); | ||
|
||
// should have correct styles | ||
expect(days[0]) | ||
.to.contain('31') | ||
.to.have.class('outside') | ||
.to.have.class('weekend') | ||
.to.have.class('custom-day'); | ||
expect(days[1]).to.contain('1').to.have.class('custom-day'); | ||
expect(days[6]) | ||
.to.contain('6') | ||
.to.have.class('weekend') | ||
.to.have.class('custom-day'); | ||
expect(days[31].innerText).to.be.equal('31'); | ||
expect(days[31]).to.have.class('custom-day'); | ||
expect(days[32]) | ||
.to.contain('1') | ||
.to.have.class('outside') | ||
.to.have.class('custom-day'); | ||
expect(days[41]) | ||
.to.contain('10') | ||
.to.have.class('outside') | ||
.to.have.class('weekend') | ||
.to.have.class('custom-day'); | ||
}); | ||
|
||
// pick another day | ||
cy.get('[aria-label="Thursday, January 18, 2018"] > .custom-day').click(); | ||
cy.get('#date-picker8') | ||
.should('have.value', '01/18/2018') | ||
.should('have.attr', 'readonly'); | ||
cy.get('#date8').should( | ||
'have.text', | ||
JSON.stringify(new Date(2018, 0, 18, 12)) | ||
); | ||
|
||
// should close calendar after picking a date | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
}); | ||
describe('date-picker tests', () => { | ||
before(() => { | ||
cy.visit(''); | ||
}); | ||
|
||
it('should show initial state', () => { | ||
cy.get('#date-picker8') | ||
.should('have.value', '01/24/2018') | ||
.should('have.attr', 'readonly'); | ||
cy.get('#date8').should('have.text', JSON.stringify(new Date(2018, 0, 24))); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should click input and open', () => { | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should click icon and open', () => { | ||
cy.get('#date-picker > date-picker > .input-group > .btn').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('#date-picker > date-picker > .input-group > .btn').click(); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should click outside and close', () => { | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('#date8').click({force: true}); | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
|
||
it('should change date when click on Jan 18', () => { | ||
cy.get('#date-picker8').click(); | ||
cy.get('date-picker ngb-datepicker').should('have.class', 'show'); | ||
cy.get('date-picker .custom-day').then((days) => { | ||
// should show correct number of days | ||
expect(days.length).to.be.equal(42); | ||
|
||
// should have correct styles | ||
expect(days[0]) | ||
.to.contain('31') | ||
.to.have.class('outside') | ||
.to.have.class('weekend') | ||
.to.have.class('custom-day'); | ||
expect(days[1]).to.contain('1').to.have.class('custom-day'); | ||
expect(days[6]) | ||
.to.contain('6') | ||
.to.have.class('weekend') | ||
.to.have.class('custom-day'); | ||
expect(days[31].innerText).to.be.equal('31'); | ||
expect(days[31]).to.have.class('custom-day'); | ||
expect(days[32]) | ||
.to.contain('1') | ||
.to.have.class('outside') | ||
.to.have.class('custom-day'); | ||
expect(days[41]) | ||
.to.contain('10') | ||
.to.have.class('outside') | ||
.to.have.class('weekend') | ||
.to.have.class('custom-day'); | ||
}); | ||
|
||
// pick another day | ||
cy.get('[aria-label="Thursday, January 18, 2018"] > .custom-day').click(); | ||
cy.get('#date-picker8') | ||
.should('have.value', '01/18/2018') | ||
.should('have.attr', 'readonly'); | ||
cy.get('#date8').should( | ||
'have.text', | ||
JSON.stringify(new Date(2018, 0, 18, 12)) | ||
); | ||
|
||
// should close calendar after picking a date | ||
cy.get('date-picker ngb-datepicker').should('not.exist'); | ||
}); | ||
}); |
Oops, something went wrong.