如何在aurelia组件中完全渲染自定义元素以进行e2e测试?

时间:2018-11-30 20:05:18

标签: aurelia aurelia-binding aurelia-router aurelia-framework aurelia-validation

我正在尝试为使用Aurelia-Bootstrap-Plugins中的aurelia-bootstrap-datetimepicker的Aurelia组件编写测试。我试图弄清楚如何在随后的abp-datetime-picker元素上触发输入事件,但是由于该元素未完全呈现而出现问题。这是我目前正在设置要测试的组件的方式:

const bindingContext = {
   model: {...}
};

const component = StageComponent
  .withResources([
    `${componentPath}`,
    'resources/elements/custom-input-field/custom-input-field',
    'resources/elements/custom-radio-field/custom-radio-field'
  ])
  .inView(`<compose view-model="${componentPath}" model.bind="model"></compose>`)
  .boundTo(bindingContext);

component.bootstrap(aurelia => {
  aurelia.use
    .standardConfiguration()
    .plugin('aurelia-validation');

如果abp-datetime-picker组件的值未在要测试的文档中完全呈现,该如何设置?

1 个答案:

答案 0 :(得分:0)

更新

问题出在我的karma.config.js中,该文件不提供node_modules html文件。该修补程序是将{pattern: 'node_modules/**/*.html', included: false}添加到业力的config.files中。