我正在为ember-power-select测试这里阅读文档。
在设置中,它说:
import registerPowerSelectHelpers from '../../tests/helpers/ember-power-select';
registerPowerSelectHelpers();
...我没有在我的ember-power-select目录中看到tests/helpers/。我应该单独安装它,还是默认情况下应该安装它?
通过运行建议的命令:ember-power-select:ember install ember-power-select,我安装了ember install ember-power-select。
我如何使用一些power-select helpers,如selectChoose()、selectSearch()、&c.就像在文档上规定的那样?
发布于 2017-04-08 08:33:32
如果您查看有关加载项的烬-cli解释;这里写着“测试-支持/-与应用程序的测试/合并”,如果您查看源代码的ember-power-select,则在test-support目录下有一个helper目录。这意味着当您安装成员-电源-选择;这个目录的行为就像它是与您的应用程序的测试目录合并。您是否在项目下看到tests/helpers/ember-power-select.js并不重要。你可以这样访问它。让我们假设您的项目名为sample-project;那么您可以导入相关函数,如下所示:
import registerPowerSelectHelpers from 'sample-project/tests/helpers/ember-power-select';在测试开始acceptance-test之前,从您的registerPowerSelectHelpers();中调用它,您就可以随意使用selectChoose()、selectSearch()。
类似地,您可以导入集成测试帮助程序,如下所示:
import { typeInSearch, clickTrigger } from 'sample-project/tests/helpers/ember-power-select'https://stackoverflow.com/questions/43286931
复制相似问题