项目作者: bahmutov

项目描述 :
Small counter example in Hyperapp and JSX (and Cypress tests)
高级语言: JavaScript
项目地址: git://github.com/bahmutov/hyperapp-counter-jsx-example.git
创建时间: 2017-12-29T19:23:28Z
项目社区:https://github.com/bahmutov/hyperapp-counter-jsx-example

开源协议:

下载


hyperapp-counter-jsx-example

Small counter example in Hyperapp and JSX (and Cypress tests)

You can mount your Hyperapp components in the tests using JSX syntax by transpiling it
in the cypress/plugins/index.js file.

  1. import { mount } from 'cypress-hyperapp-unit-test'
  2. import { Counter } from '../../src/components/counter'
  3. it('calls onclick', () => {
  4. const label = 'calls onclick'
  5. const onclick = cy.spy()
  6. // our component to test
  7. const component = <Counter label={label} onclick={onclick} ></Counter>
  8. mount({}, {}, () => component)
  9. cy
  10. .contains(label)
  11. .click()
  12. .then(() => {
  13. expect(onclick).to.have.been.calledOnce
  14. })
  15. })

When running the test in Cypress you have full browser and can interact / inspect every test step by step.

Spec

Test examples

Application code is in src folder. All tests are in cypress/integration folder

More info