File size: 3,426 Bytes
4d70170 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
import { suite } from '../utils/suite'
suite('vuex edit', () => {
it('should edit state using the decrease button', () => {
cy.get('.vuex-tab').click()
cy.get('[data-id="load-vuex-state"]').click()
// using the decrease button
cy.get('.state .data-field').eq(0)
.find('.actions .vue-ui-button').eq(1)
.click({ force: true })
cy.get('.vuex-state-inspector').within(() => {
cy.get('.key').contains('count').parent().contains('-1')
})
cy.get('.state .data-field').eq(0)
.find('.actions .vue-ui-button').eq(1)
.click({ force: true })
cy.get('.vuex-state-inspector').within(() => {
cy.get('.key').contains('count').parent().contains('-2')
})
cy.get('#target').iframe().then(({ get }) => {
get('#counter p').contains('-2')
})
})
it('should edit state using the increase button', () => {
// using the increase button
cy.get('.state .data-field').eq(0).click()
.find('.actions .vue-ui-button').eq(2)
.click({ force: true })
cy.get('.vuex-state-inspector').within(() => {
cy.get('.key').contains('count').parent().contains('-1')
})
cy.get('.state .data-field').eq(0).click()
.find('.actions .vue-ui-button').eq(2)
.click({ force: true })
cy.get('.vuex-state-inspector').within(() => {
cy.get('.key').contains('count').parent().contains('0')
})
cy.get('#target').iframe().then(({ get }) => {
get('#counter p').contains('0')
})
})
it('should edit state using the edit input', () => {
// using the edit input
cy.get('.state .data-field').eq(0).click()
.find('.actions .vue-ui-button').eq(0).click({ force: true })
cy.get('.edit-input').type('12')
cy.get('.edit-overlay > .actions > :nth-child(2) > .content > .vue-ui-icon').click()
cy.wait(200)
cy.get('#target').iframe().then(({ get }) => {
get('#counter p').contains('12')
})
// change count back to 1
cy.get('.state .data-field').eq(0).click()
.find('.actions .vue-ui-button').eq(0).click({ force: true })
cy.get('.edit-input').type('0')
cy.get('.edit-overlay > .actions > :nth-child(2) > .content > .vue-ui-icon').click()
cy.wait(200)
cy.get('#target').iframe().then(({ get }) => {
get('#counter p').contains('0')
})
})
it('should edit state nested field', () => {
// using the decrease button
cy.get('.data-field > .children > .data-field').eq(4)
.find('.actions .vue-ui-button').eq(1)
.click({ force: true })
.click({ force: true })
cy.wait(200)
cy.get('#target').iframe().then(({ get }) => {
get('#vuex-object pre').contains('-2')
})
// using the increase button
cy.get('.data-field > .children > .data-field').eq(4)
.find('.actions .vue-ui-button').eq(2)
.click({ force: true })
.click({ force: true })
cy.wait(200)
cy.get('#target').iframe().then(({ get }) => {
get('#vuex-object pre').contains('0')
})
// using the input
cy.get('.data-field > .children > .data-field').eq(4)
.find('.actions .vue-ui-button').eq(0).click({ force: true })
cy.get('.edit-input').eq(1).type('12')
cy.get('.edit-overlay > .actions > :nth-child(2) > .content > .vue-ui-icon').click()
cy.wait(200)
cy.get('#target').iframe().then(({ get }) => {
get('#vuex-object pre').contains('12')
})
})
})
|