I recently added a feature in vuejs and am having trouble testing it.
I created a spec file for simply visiting the page but anything on my html that has logic such as a v-show
does not get rendered in the test. I added an onload to see if it might render
window.onload = function () {
new Vue({
el: 'body',
....
});
}
but upon running the spec I still get multiple vue warnings like this:
[Vue warn]: Error when evaluating expression "settingIds.includes(setting.id)": TypeError: 'undefined' is not a
function (evaluating 'scope.settingsIds.includes(scope.setting.id)')`
Note: I am using localstorage which some of my view logic depends on and I'm not sure if capybara supports it
假设settingsIds是一个数组-包括PhantomJS或IE不支持的ES7方法(您应该运行的最新PhantomJS 2.1.1,支持的是ES5)-您需要不使用ES6 /来重写代码7种方法,将其转码为ES5或使用poltergeist扩展选项进行polyfill
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.