Browse Source

wip: cypress tests

master
kevmodrome 6 years ago
parent
commit
68dfb678e1
  1. 6
      packages/builder/cypress/integration/createBinding.spec.js
  2. 6
      packages/builder/src/components/userInterface/PropertyControl.svelte

6
packages/builder/cypress/integration/createBinding.spec.js

@ -2,9 +2,6 @@ context('Create a Binding', () => {
before(() => { before(() => {
cy.visit('localhost:4001/_builder') cy.visit('localhost:4001/_builder')
cy.createApp('Binding App', 'Binding App Description') cy.createApp('Binding App', 'Binding App Description')
cy.createTable('dog')
cy.addColumn('dog', 'name', 'Plain Text')
cy.addRecord(["Rover"])
cy.navigateToFrontend() cy.navigateToFrontend()
}) })
@ -16,7 +13,6 @@ context('Create a Binding', () => {
cy.contains("Heading").click() cy.contains("Heading").click()
cy.get("[data-cy=text-binding-button]").click() cy.get("[data-cy=text-binding-button]").click()
cy.get("[data-cy=binding-dropdown-modal]").contains('Input 1').click() cy.get("[data-cy=binding-dropdown-modal]").contains('Input 1').click()
cy.contains('Home{{ Input 1 }}') cy.get("[data-cy=binding-dropdown-modal] textarea").should('have.value', 'Home{{ Input 1 }}')
}) })
}) })

6
packages/builder/src/components/userInterface/PropertyControl.svelte

@ -20,12 +20,12 @@
handleChange(key, temporaryBindableValue) handleChange(key, temporaryBindableValue)
} }
let bindableProperties let bindableProperties = []
let anchor let anchor
let dropdown let dropdown
async function getBindableProperties() { function getBindableProperties() {
// Get all bindableProperties // Get all bindableProperties
bindableProperties = fetchBindableProperties({ bindableProperties = fetchBindableProperties({
componentInstanceId: $store.currentComponentInfo._id, componentInstanceId: $store.currentComponentInfo._id,
@ -36,7 +36,7 @@
} }
const CAPTURE_VAR_INSIDE_MUSTACHE = /{{([^}]+)}}/g const CAPTURE_VAR_INSIDE_MUSTACHE = /{{([^}]+)}}/g
async function replaceBindings(textWithBindings) { function replaceBindings(textWithBindings) {
getBindableProperties() getBindableProperties()
// Find all instances of mustasche // Find all instances of mustasche
const boundValues = textWithBindings.match(CAPTURE_VAR_INSIDE_MUSTACHE) const boundValues = textWithBindings.match(CAPTURE_VAR_INSIDE_MUSTACHE)

Loading…
Cancel
Save