index.test.js 725 B

123456789101112131415
  1. const _ = require('./utils')
  2. test('render', async () => {
  3. const componentId = _.load('index', 'comp')
  4. const component = _.render(componentId, {prop: 'index.test.properties'})
  5. const parent = document.createElement('parent-wrapper')
  6. component.attach(parent)
  7. expect(_.match(component.dom, '<wx-view class="comp--index comp--other">index.test.properties-false</wx-view><other><wx-view class="other--index other--other">other.properties-other</wx-view></other>')).toBe(true)
  8. await _.sleep(10)
  9. expect(_.match(component.dom, '<wx-view class="comp--index comp--other">index.test.properties-true</wx-view><other><wx-view class="other--index other--other">other.properties-other</wx-view></other>')).toBe(true)
  10. })