qunit

Form Regex that finds pattern within a repeating decimal

随声附和 提交于 2021-02-07 19:45:39
问题 How can I form a regular expression that match the unique numbers that repeat in a repeating decimals? Currently my regular expressions is the following. var re = /(?:[^\.]+\.\d*)(\d+)+(?:\1)$/; Example: // Pass deepEqual( func(1/111), [ "0.009009009009009009", "009" ] ); // Fails, since func(11/111) returns [ "0.099099099099099", "9" ] deepEqual( func(11/111), [ "0.099099099099099", "099" ] ); Live demo here: http://jsfiddle.net/9dGsw/ Here's my code. // Goal: Find the pattern within

How can I unit test an event listener on an input field?

南楼画角 提交于 2021-02-07 14:30:35
问题 In the simplest test possible, I'm attempting to test the following function: addPercentSign: function (oEvent, control) { var inputVal = oEvent.getParameters().value; var inputNumber = parseFloat(inputVal); if (inputNumber) { if (inputNumber < 50 || inputNumber > 100) { //see learningCurveFormatCheck return null; } else { var finalVal = inputNumber.toFixed(1); var finalOutput = finalVal + "%"; control.learningCurve.setValue(finalOutput); return finalOutput; }; } } The above function is an

I tried to maka a QUnit async test for checking ajax update

纵然是瞬间 提交于 2021-01-29 09:29:48
问题 I tried to maka a QUnit async test for checking ajax update. I read of QUnit.asyncTest here https://www.sitepoint.com/test-asynchronous-code-qunit/ but if i try this i get a TypeError: QUnit.asyncTest is not a function thats the complete source: https://gist.github.com/232457b002e5363439aece7535600356 of course i new by using QUnit and used JavaScript not for long time. that a snippet of the part where the error happens: function max() { var max = -Infinity; for (var i = 0; i < arguments

How can I write tests that have setup and teardown operations that are asynchronous?

百般思念 提交于 2021-01-28 07:03:09
问题 I am using a library (pouchDB) that does some async operations. To keep things simple, I will keep the details out of it as I think this is a general issue with "unit testing" involving async operations (unit testing in quotation marks because I guess this isn't truly unit testing if I am testing integration with another library. But, using QUnit seems like the most appropriate way to write tests for it). I am using QUnit to do my js unit testing. I have two tests. I am finding that if I run

Ember concurrency timeout hanging in qunit

我是研究僧i 提交于 2021-01-27 20:08:46
问题 In Ember I have a component that starts a never-ending poll to keep some data up to date. Like so: export default Component.extend({ pollTask: task(function * () { while(true) { yield timeout(this.get('pollRate')); this.fetchSomeData(); } }).on('init') }) This causes a preexisting acceptance test to get stuck in this task and run forever, even though it should be run asynchronously. The test looks like this: test('my test', async function(assert) { mockFindRecord(make('fetched-model')); await

史上最全软件开发|程序员必备的工具集

瘦欲@ 提交于 2021-01-11 15:23:38
史上最全软件开发|程序员必备的工具集 软件开发程序员在整个产品研发的过程中起着很重要的作用, 由于经常研究各种技术,他不会精确记得所有语言代码的语法和API,他觉得没有Google和百度,几乎没法工作。他记的只是一个Key,一个如何找寻答案的索引,而不是全部 。正所谓 “工欲善其事必先利其器”我们程序员也是一样,选择一个好工具可以大大提升开发效率,下面是我使用的一些并且觉得很不错的软件,和大家分享下。 最后还会给大家介绍一款我最近在 测试全流程一站式的测试神器。 一、办公类: 软件开发工程师常用工具: 1.1、OneNote: https://www.onenote.com/download/ 微软office自带的一款类似笔记本的软件,我一般所有的学习笔记都是放在上面的,跟有道云笔记类似,推荐使用,华为研发人员大多都是用这个,谁用谁知道 1.2、Teamviewer:这是一款非常好用的多人回忆演示等集一体的软件,类似于华为内部使用的Espace软件 1.3、腾讯文档: https://docs.qq.com/desktop 1.4、Processon免费作图: https://www.processon.com/ 二、研发类: 2.1、Github: https://github.com/ 适合团队开发人员之间共同开发时使用 2.2、SVN: https:/