草庐IT

value_test

全部标签

javascript - 如何使用 vue-test-utils 测试 CSS 框架自定义组件

我使用的是BuefyCSS框架,它提供自定义vue-js组件,例如和,我在测试时遇到了问题标签。import{shallowMount,createLocalVue}from'@vue/test-utils'importBInputPracticefrom'../BInputPractice.vue'importBuefyfrom'buefy'constlocalVue=createLocalVue()localVue.use(Buefy)describe('b-inputPractice',()=>{it('updatesthenamedataproperty',()=>{const

javascript - 如何将 Jest 中的 '__mocks__' 文件夹移动到/test?

我已经开始在Jest中使用mocks来测试我的NodeJS应用程序并且它们工作得很好,但是将__mocks__文件夹移动到/test文件夹会更有意义所以与测试相关的所有内容都在那里,而不是在/src中混合文件。这在某种程度上是可能的吗?我在Jest文档中的任何地方都找不到它。 最佳答案 jest.mock('../src/service',()=>require('./__mocks__/request'));这对我有用 关于javascript-如何将Jest中的'__mocks__'

javascript - 如何更改h :outputText value by JavaScript?

我已经用2个inputText测试过,它运行良好例如vartdate=document.getElementById('txtDate');//h:inputTextvartdt=document.getElementById('txtDateTime');//h:inputTexttdate.onchange=function(){tdt.value=tdate.value;};如何更改“tdt”-h:outputText的值?vartdate=document.getElementById('txtDate');//h:inputTextvartdt=document.getEle

c# - SCRIPT5009 : 'JSON' is undefined in IE 10 The value of the property '$' is null or undefined, 不是函数对象

HelloWorld$(document).ready(function(){});$(document).ready(function(){$("#width").val($(window).width());$("#height").val($(window).height());});上面是我的aspx代码和jquery脚本,它给出了窗口的高度和宽度。当我从visualstudiohttp://localhost/Mypage.aspx运行web应用程序时,这段代码在所有浏览器上都完美无缺但是当我在iis上托管它并使用我的机器名称http://MyMachine/Mypage.a

javascript - 优化 : Get specific Value(and not more) from IndexedDB

我正在做的是在客户端上保存和检索大量图像。(现在indexedDB对于这个简单的工作来说似乎有点过分了,但是因为它是唯一没有限制的跨浏览器解决方案(比如localStorage),所以我不得不使用它......而且它有效)这是我的数据库的样子:(更具体地说,我的数据库的唯一对象库)#|key(timeID)|value0|812378123|{data:¨....¨,tnData:¨...¨,timeID:812378123}1|912378123|{data:¨....¨,tnData:¨...¨,timeID:912378123}2....KeyValue是一个唯一的TimeID,

javascript - Angular Testing 错误 - NullInjectorError : No provider for TrimInputDirective

我创建了一个Angular指令,它使用CSS选择器自动trim我的应用程序中的输入,它看起来像这样......import{Directive,HostListener,forwardRef}from'@angular/core';import{DefaultValueAccessor,NG_VALUE_ACCESSOR}from'@angular/forms';exportconstTRIM_VALUE_ACCESSOR:any={provide:NG_VALUE_ACCESSOR,useExisting:forwardRef(()=>TrimInputDirective),mult

javascript - react / enzyme : How to test for subcomponent?

这就是我的Messenger组件的样子。如您所见,有一个主要组件和一个列表组件。主要组件默认导出。有了这个,我的应用程序中的一切都按预期工作。/imports/ui/components/messenger.jsximportReact,{Component}from'react'importPropTypesfrom'prop-types'import{Container,Segment,Loader,Header}from'semantic-ui-react'classMessengerextendsComponent{staticgetpropTypes(){return{dat

javascript - knockout : Change css class based on value of observable

我在可观察数组上使用foreach:如您所见,我将可用性的当前值传递给函数availabilityCssClass,该函数将该值与一些预定义的字符串进行比较。根据匹配的字符串,它返回一个类名。self.availabilityCssClass=ko.computed(function(value){varavailability=value;if(availability==="Busy"||"DoNotDisturb"||"BeRightBack")return"leftStatusCellColorOrange";elseif(availability==="Away"||"Off

javascript - 以现代方式获取 <select> 的值(value)?

我是undertheimpression为了从中获取值你基本上必须这样做:varsel=document.getElementById("my-select");varval=sel.options[sel.selectedIndex].value;但是我ranintosomecodetoday这就是document.getElementById('my-select').value,这似乎在Chrome和Firefox中运行良好。最近有变化吗,还是一直这样?这支持多远? 最佳答案 mySelect.value至少从1998年10月

javascript - VueJS : input with dynamic value + v-model

在设置输入radio和v模型的值时,我遇到了VueJS问题。我不明白为什么我不能为输入动态设置值并使用模型来检索用户选择的输入。在代码中更容易理解:exportdefault{props:["question","currentQuestion"],data(){return{answer:undefined}},computed:{isCurrent(){returnthis.currentQuestion&&this.currentQuestion.id==this.question.id;}},methods:{groupName(question){return'questio