qunit

grunt not running QUnit tests on phantom

风格不统一 提交于 2019-12-17 20:15:41
问题 I've got a repository which is integrated with travis. I've got QUnit tests which I'd like to run from grunt/node server side and AMD (requirejs). This is the source of my AMD init.js: (function () { require.config({ baseUrl: "../src" }); require(["../test/suites/basic", '../test/qunit-extend', 'qunit' ], function(BasicTests) { QUnit.config.autoload = false; QUnit.config.autostart = false; BasicTests.run(); QUnit.load(); QUnit.start(); }); }()); When I run those QUnit tests within my browser

blanket.js not working with qunit in Ember-cli

二次信任 提交于 2019-12-14 02:45:05
问题 I would like to run blanket.js with qunit in my Ember-Cli app - I would like to avoid adding in grunt for only this purpose Tried to use npm install --save-dev blanket ( putting it in the node_modules dir ) and then putting the following in my index.html ( from my test dir ) <script> window.CioMobileENV = {{ENV}}; window.EmberENV = window.CioMobileENV.EmberENV; debugger; </script> <script src="assets/qunit.js"></script> <script src="assets/qunit-notifications.js"></script> <script src=

How to stub component's action in ember?

前提是你 提交于 2019-12-14 02:24:52
问题 I created a component, whose action uses store service. How can I stub this action from integration test? // app/components/invoice-form.js export default Ember.Component.extend({ actions: { loadPartners() { let self = this; this.get('store').findAll('partner').then(function(partners) { self.set('partners', partners); }); } } }); In this component's template I pass this action as closure to child component: {{button-confirmation text="Are you sure?" onConfirm=(action "loadPartners")}} In my

QUnit stubbing out methods on a dependency breaks tests against that dependency

为君一笑 提交于 2019-12-14 01:34:23
问题 In Google Apps Script, I'm unit-testing an app that I'm working on, using QUnit, using test-driven-development. The code under test I am, right now, working on fully testing, and then developing, the following function: /** * * Creates a Sheet from a long string of data * @param { string } data : the long string of data * @returns { Sheet } the newly-created Sheet **/ function createSheetFrom(data) { // if data is not in the form of a string, we've got a problem if (data !== data.toString())

extending Backbone.Collection prototype

依然范特西╮ 提交于 2019-12-13 17:09:06
问题 Following on from this question, I'm trying to augment Backbone.Collection with some custom methods. However, I'm getting some inconsistent behaviour between the console and the source. Here's how the test looks HTML ... <script type="text/javascript" src="./libs/underscore.js"></script> <script type="text/javascript" src="./libs/backbone.js"></script> <script type="text/javascript" src="./libs/backbone-extend.js"></script> <script type="text/javascript" src="./qunit/qunit.js"></script>

Verifying Qunit's results with Zombie.js

半腔热情 提交于 2019-12-13 15:36:07
问题 I am doing test-driven development with Qunit: when creating a new function, I write tests for it, create the function, reload the page, and if all the tests pass I move on... Whilst this works fine at the beginning, it starts to become a time consuming process after a while as all the tests take several seconds to run, and that's the time I have to wait for every time I refresh my browser. In an attempt to workaround that problem, I thought about introducing Zombie.js to perform head-less

How to install and setup Testswarm?

落花浮王杯 提交于 2019-12-13 14:53:26
问题 ![enter image description here][1]Testswarm is a Continuous Integration Testing Framework. Can anybody tell me how to install and use it? I have checked the read me on github and installed Testswarm, but I am unable to add jobs or run them. I added one project by inserting details in database. I have downloaded qUnit, so please tell me how to write tests in it for Testswarm. 回答1: The process depends on your environment. Here are some options: TestSwarm Prerequisites Setting up TestSwarm

Qunit unit test error , on jQuery ajax

空扰寡人 提交于 2019-12-13 14:22:14
问题 I have written unit test for ajax suing Qunit, but getting error like Error: assertion outside test context, was .success@http://test.loc/assets/test/widget-add-or-edit-test.js:227 b.Callbacks/c@http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js:3 b.Callbacks/p.fireWith@http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js:3 k@http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js:5 .send/r@http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js:5

Javascript Sandbox unit testing

穿精又带淫゛_ 提交于 2019-12-13 13:08:16
问题 I am using QUnit, which is excellent. I have enclosed my JS app in the (function () {})(); sandbox. This hides a lot of code that I don't want public, but I also need to test that code. Here is an example of how this works: (function () { var PublicAPI = window.PublicAPI = {}; PublicAPI.publicFunction = function (foo) { PrivateAPI.privateFunction(foo); return 'bar'; }; var PrivateAPI = {}; PrivateAPI.privateFunction: function (foo) { // Make secret stuff that never gets returned to the public

QUnit how to test events?

点点圈 提交于 2019-12-13 02:47:51
问题 I have an html page with a button like this: <input id='btnSubmit' type='button'/> which triggers a click handler defined within the document.ready function like this: $(document).ready(function () { $("#btnSubmit").click(function () { $.ajax({ url: myUrl, data: { 'startDate': startDateId, 'endDate': endDateId }, dataType: "json", type: "POST", cache: false, success: function (data) { alert('yay!'); }, error: function (request, status, error) { LogError(request, startDate, error); location