草庐IT

test_node_xx

全部标签

javascript - Rails + Jasmine-Ajax : what is the correct way to test code triggered by `ajax:success` (jquery-ujs)

我正在尝试测试某个内部库,该库在ajax:success事件上触发了一些JS行为。库创建一个如下所示的链接:在库的JS部分有事件绑定(bind)代码,这是我想通过它对DOM的影响进行黑盒测试的部分:$(document).on'ajax:success','.special-link',(e,data,status,xhr)->#CodethathassomeeffectontheDOMasafunctionoftheserverresponse该库在浏览器中按预期工作。但是,当我尝试通过调用$('.special-link').click()测试Jasmine中的库时,无法观察到对D

javascript - react 和 Jest : Cannot find module from test file

为目录中的Redux操作('App.js')设置Jest测试('App-test.js')app/__tests__:这是App.js的header:jest.unmock('../../modules/actions/App.js')importReactfrom'react'importReactDOMfrom'react-dom'importTestUtilsfrom'react-addons-test-utils'import*asAppfrom'../../modules/actions/App.js'在app/有一个模块config.js.这是在需要的地方导入的。问题是,当

javascript - before/afterAll() 未在 jasmine-node 中定义

我正在尝试使用jasmine的beforeAll和afterAll方法,用frisby.js创建一套测试,因为实际上,frisby不支持这种方法。所以,这就是我想要做的:varfrisby=require('frisby');describe("setUpandtearDown",function(){beforeAll(function(){console.log("testbeforeAll");});afterAll(function(){console.log("afterAll");});//FRISBYTESTS});//endofdescribefunction如果我将b

javascript - 如何在没有 node.js/npm 的情况下在本地使用 Angular2、systemjs?

这是带有angular-alpha35的index.html:APPAng2Loading...System.import('app').catch(console.log.bind(console));如果有互联网连接并且可以加载system.js,它工作正常。如果我尝试像这样获取system.js的本地副本:在我将rx.js放入根文件夹并将这一行放在文件末尾之前,一切都不起作用:然后System.js工作正常,但在这种情况下,angular2绑定(bind)存在一个奇怪的问题。在我与页面进行一些交互之前,它们不会工作(提交表单、打开选择、使某些div更改其尺寸,即使使用简单的隐藏等

javascript - yarn ,node-gyp 重建编译错误,node_modules/fsevents : Command failed

我正在使用Yarn来处理包裹。yarninstall显示错误,无论我使用什么包,但安装看起来成功完成,文件直接设置在node-modules下。(不知何故jquery-ui没有出现在node-modules下)我删除了yarn.lock并再次尝试,但没有成功。有人能帮忙吗?我的环境是这样的:whitebear$yarn-v1.10.1whitebear$node-vv11.0.0whitebear$npm-v6.4.1包.json{"devDependencies":{"@symfony/webpack-encore":"^0.20.0","bootstrap":"^4.1.3","j

javascript - Node.appendChild 的参数 1 没有实现接口(interface) Node

我是JavaScript的新手,我不知道什么是接口(interface)节点?下面是我的错误代码Panel=function(){varpopUpDiv=document.getElementById("firewall-content");varpanelDiv=$("").addClass("side_panel");popUpDiv.appendChild(panelDiv);}; 最佳答案 appendChild是原生DOM方法,只接受DOM节点作为参数。您尝试附加的元素(panelDiv)是一个jQuery对象,而不是DO

javascript - node_modules 文件夹上的 Github Pages 404

我正在尝试使用GitHub页面使用JavaScript在发布者-订阅者模块上呈现我的GitHub存储库。gh-pages分支看起来不错。但是,mustache代码不会呈现在我在GitHubPages上的项目中。它看起来像这样:GitHub存储库:https://github.com/ajhalthor/pubsub-application此项目的Github页面repo:https://ajhalthor.github.io/pubsub-application/GitHub存储库也有node_modules文件夹,所以它应该是自给自足的。Mustache、jQuery和Bootstr

javascript - Angular - TypeError : XX is not a function

也许我缺少某种属性,但我正在关注这个project我在我的Controller中收到此错误。TypeError:loginService.signinisnotafunction这是我的controller.jsangular.module('appcontrollers',[]).controller('LoginController',['$rootScope','$scope','$http','$location','$localStorage','loginService',function($rootScope,$scope,$http,loginService){$sco

javascript - Protractor 和 Angular : How to test two pages in an app, 一个接一个?

我想在我的Angular应用程序的两个单独页面上运行Protractor测试:/dashboard和/articles。复杂的是我必须手动登录应用程序。目前我有这个设置:varLoginPage=function(){ptor=protractor.getInstance();this.login=function(url){ptor.get(url);ptor.findElement(protractor.By.model('email')).sendKeys(config.LOGIN_EMAIL);ptor.findElement(protractor.By.model('pass

vue-cli安装后vue -V报错:C:\Users\admin\AppData\Roaming\npm\node_modules\@vue\cli\bin\vue.js

运行vue-V一直报错,网上常识各种办法无效。包括:卸载:npmuninstall-g@vue/cli和npmuninstall-gvue-cli重新安装:npminstall-gvue-cli和npminstall-g@vue/cli清理缓存:npmcacheclean--force更新:npmupdate关机重启N次然而依旧:然并卵…依然报错:C:\Users\admin\AppData\Roaming\npm\node_modules@vue\cli\bin\vue.js(看控制台报错信息,有些人不是:admin角色)解决办法:进入文件夹,输入地址:C:\Users\admin\AppD