File size: 4,345 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 |
import { suite } from '../utils/suite'
suite('component data edit', () => {
it('should edit data using the decrease button', () => {
// select Instance
cy.get('.instance:nth-child(1) .instance:nth-child(2)').eq(0).click()
cy.get('.component-state-inspector .data-type').should('contain', 'data')
cy.get('.data-field').eq(7).find('.actions .vue-ui-button').eq(1).click({ force: true })
cy.get('.component-state-inspector').within(() => {
cy.get('.key').contains('0').parent().get('.value').contains('0')
})
cy.get('.data-field').eq(7).find('.actions .vue-ui-button').eq(1).click({ force: true })
cy.get('.component-state-inspector').within(() => {
cy.get('.key').contains('0').parent().contains('-1')
})
// expect DOM element to be updated
cy.get('#target').iframe().then(({ get }) => {
get('#target div').eq(0).contains('-1')
})
})
it('should edit data using the increase button', () => {
cy.get('.instance:nth-child(1) .instance:nth-child(2)').eq(0).click()
cy.get('.component-state-inspector .data-type').should('contain', 'data')
cy.get('.data-field').eq(7).find('.actions .vue-ui-button').eq(2).click({ force: true })
cy.get('.component-state-inspector').within(() => {
cy.get('.key').contains('0').parent().get('.value').contains('0')
})
// expect DOM element to be updated
cy.get('#target').iframe().then(({ get }) => {
get('#target div').eq(0).contains('0')
})
})
it('should edit data using the edit input', () => {
cy.get('.instance:nth-child(1) .instance:nth-child(2)').eq(0).click()
cy.get('.data-field').eq(7).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.get('.component-state-inspector').within(() => {
cy.get('.key').contains('0').parent().get('.value').contains('12')
})
// expect DOM element to be updated
cy.get('#target').iframe().then(({ get }) => {
get('#target div').eq(0).contains('12')
})
})
it('should add elements to array', () => {
cy.get('.instance:nth-child(1) .instance:nth-child(2)').eq(0).click()
cy.get('.data-field').eq(6).find('.actions .vue-ui-button').eq(1).click({ force: true })
cy.get('.edit-input').type('55')
cy.get('.edit-overlay > .actions > :nth-child(2) > .content > .vue-ui-icon').click()
cy.get('.data-field').eq(6).find('.children .data-field').should('have.length', '3', { timeout: 5000 })
cy.get('.component-state-inspector').within(() => {
cy.get('.key').contains('2').parent().get('.value').contains('55')
})
// expect DOM element to be updated
cy.get('#target').iframe().then(({ get }) => {
get('#target div').eq(4).contains('55')
})
})
it('should remove elements from array', () => {
cy.get('.instance:nth-child(1) .instance:nth-child(2)').eq(0).click()
cy.get('.data-field').eq(9).find('.actions .vue-ui-button').eq(3).click({ force: true })
cy.get('.data-field').eq(6).find('.children .data-field').should('have.length', '2', { timeout: 5000 })
})
it('should parse object through edit input', () => {
cy.get('.instance:nth-child(1) .instance:nth-child(2)').eq(0).click()
cy.get('.data-field').eq(7).find('.actions .vue-ui-button').eq(0).click({ force: true })
cy.get('.edit-input').type('{{}"count":42}')
cy.get('.edit-overlay > .actions > :nth-child(2) > .content > .vue-ui-icon').click()
cy.get('.data-field').eq(7).should('contain', 'Object', { timeout: 5000 })
// expand object
cy.get('.data-field').eq(7).click()
cy.get('.data-field').eq(8).find('.key').should('contain', 'count', { timeout: 5000 })
cy.get('.data-field').eq(8).find('.value').should('contain', 42, { timeout: 5000 })
})
it('should rename object\'s property', () => {
cy.get('.instance:nth-child(1) .instance:nth-child(2)').eq(0).click()
cy.get('.data-field').eq(8).find('.actions .vue-ui-button').eq(0).click({ force: true })
cy.get('.edit-input.key-input').clear().type('name')
cy.get('.edit-overlay > .actions > :nth-child(2) > .content > .vue-ui-icon').click()
cy.get('.data-field').eq(8).find('.key').should('contain', 'name', { timeout: 5000 })
})
})
|