Skip to content

Commit

Permalink
test(): add value outside change coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
NetCZ committed Aug 21, 2018
1 parent 1350d83 commit 5f0bbdd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/specs/external-date-change.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import moment from 'moment';

const updatedDateCurrent = moment();
const updatedDateWeekForward = moment().add(7, 'days');

const component = {
template: `<div>
<vue-pikaday
v-model="date"
data-vue-pikaday
></vue-pikaday>
<button @click="updateDateCurrent()" data-test="update-button-current">Update date to current</button>
<button @click="updateDateWeekForward()" data-test="update-button-week">Update date to week from now</button>
</div>`,
methods: {
updateDateCurrent() {
this.date = updatedDateCurrent.toDate();
},
updateDateWeekForward() {
this.date = updatedDateWeekForward.toDate();
}
}
};

describe.only('Component', () => {
before(() => cy.mount(component));

it('updates Pikaday value from outside', () => {
cy.get('[data-test="update-button-current"]').click();
cy.get('[data-vue-pikaday]').as('picker').should('have.value', updatedDateCurrent.format('D MMM YYYY'));

cy.get('[data-test="update-button-week"]').click();
cy.get('@picker').should('have.value', updatedDateWeekForward.format('D MMM YYYY'));
});
});

0 comments on commit 5f0bbdd

Please # to comment.