0

使用 Twitter Flight 运行 Jasmine 测试时遇到问题。我正在使用jasmine-flight插件。

错误

Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
TypeError: this.Component is not a constructor
    at Object.setupComponent (/frontend/bower_components/jasmine-flight/lib/jasmine-flight.js:44:23)
    at Object.<anonymous> (/frontend/test/spec/component_ui/list-spec.js:5:10)
TypeError: Cannot read property 'trigger' of null
    at Object.<anonymous> (/frontend/test/spec/component_ui/list-spec.js:19:19)

测试组件

    describeComponent('javascript/component_ui/list-ui', function() {
      'use strict';
  beforeEach(function() {
    jasmine.getFixtures().fixturesPath = 'base/test/fixtures';
    this.setupComponent(
        readFixtures('list.html'),
        {
          listRightMenu: '.list-right',
          listSortSelector: '.list-sort',
        }
      );
  });

      it('Show menu when button is clicked', function() {

        console.log(this);

        this.component.trigger(this.component.attr.listSortSelector, 'click');
        expect(this.component.attr.listRightMenu).toBeVisible();
      });
    });
4

0 回答 0