Questions tagged [mockjax]

jQuery Mockjax provides request/response mocking for ajax requests with jQuery and provides all standard behaviors in the request/response flow.

jQuery Mockjax provides request/response mocking for ajax requests with jQuery and provides all standard behaviors in the request/response flow.

github page

73 questions
0
votes
1 answer

Why is mockjax returning readystate 0 on inline json responsetext?

I'm starting to write some unit test for my javascript code using qunit and mockjax. I'm following the repository principle for retrieving my data. In each repository are some ajax calls to urls that return me some json data. In my unit test I want…
Bas Slagter
  • 9,831
  • 7
  • 47
  • 78
0
votes
0 answers

Store ajax response in json file with Mockjax

I am currently doing an exercise on jQuery, Mockjax, Ajax and JSON. but it seems that Mockjax doesn't work perfectly. Here is what I am trying: function mockJaxTest(param){ var url_pos = "http://localhost:8080/project/dashboard/"+param+".htm"; …
hnacer
  • 3
  • 4
0
votes
0 answers

Mock Ajax Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

This is my AJAX : $('#FormPengeluaran').validate({ submitHandler: function() { if (confirm("Are you sure you want to save?")) { var Data = $("#FormPengeluaran").serialize(); $.ajax({ type:…
0
votes
1 answer

Error is occur when I pass the JSON value in AJAX url

When I pass the json request in ajax url following error occur. I have pass the 200 and above datas in ajax. All my data's come from "/search/searchendpoint" url controller: $searchitem = $this->MbPriceList->find('all' , [ 'fields' => [ 'id',…
Ganesh
  • 89
  • 6
0
votes
2 answers

Jquery/Ajax loader's time to depend on page's loading time

Situation: I am looking for a jquery/ajax loader and found this thread helpful. Now I am using this fiddle as my loader. Everything works fine but I only have one concern. Below the js code, 'responseTime' is fixed to 2.5 secs. $.mockjax({ url:…
Jorz
  • 358
  • 5
  • 22
0
votes
2 answers

Angularjs - Merging data between parent and child scope - Timesheet project

I am reworking my code to angular for a timesheet project that ive done with javascript/jquery logic. I am trying to take advantage of the angular functions to get everything working smoothly but I am very confused on how to get this working on a…
Daniel Ellison
  • 1,339
  • 4
  • 27
  • 49
0
votes
1 answer

How to start `mockjax` back after `stop`

In my application I have a shuffle button to start and stop the mockjax response. as a first time, I am initiating the mockjax it works. later the user click on off button to stop mockjax service. ( I am showing server data ) for stop I…
user2024080
  • 1
  • 14
  • 56
  • 96
0
votes
1 answer

mockjax response not working

I have some little problem with understanding mockjax. I have this mockjax code: $.mockjax({ url: "get_image.php", responseText:{ hello: 'world' } }); What should be js code to alert 'world'? Maybe this? $.getJson("url" , function(){ …
0
votes
1 answer

Changing jquery-mockjax return data in the middle of a mocha test

I'm writing tests with mocha that check that a changing state polled from a rest api is rendered correctly. Is it possible to change what the mocked endpoint returns in the middle of the test? I've tried overriding the mocked endpoint and using var…
mjuopperi
  • 773
  • 7
  • 25
0
votes
0 answers

mockjax: include/exclude urls for mockjax

I am using bootstrap theme plugin. it has mockjax used internally. in my application in one page iam keeping some some javascript files with src attribute. so mockjax is mocking these js files and my page is not working. how to avoid this mocking…
0
votes
1 answer

API mocking in Mithril for front-end development, like jquery-mockjax

I am using mithril in an IoT framework. I am trying to isolate the front-end development from backend API implementation tasks. In jQuery, I have used jQuery-mockjax and a similar mechanism in Angular. What I understand is that those libraries…
Sajith
  • 106
  • 5
0
votes
2 answers

Does mockjax provide more functionality then sinon.js for faking ajax call?

I can fake ajax with both of these tools. Sinon allow to create stub/spy/mock that come handy for testing and mockjax doesn't. When it come to faking ajax call, does mockjax provide more features then Sinon? Cause if it doesn't, there is no point…
AXMIM
  • 2,424
  • 1
  • 20
  • 38
0
votes
1 answer

MockJax is not sending response to my AJAX request in JavaScript application

I am using a jQuery library called MockAjax which allows you to mock/test real AJAX calls. In my application I can use my live app version of an AJAX request and MockAjax will intercept the AJAX request and respond with a Mock response! I am also…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
0
votes
2 answers

MockJAX not responding to CasperJS

Below is my code which uses casperjs and mockjax . However , mockjax is not able to intercept the ajax call . It returns the ajax response instead of the mock response . Also, $.mockjax.mockedAjaxCalls().length this does not print anything . Any…
0
votes
1 answer

Karma runner and mockjax working differently in DEBUG

I have this code that is getting called from my jasmine test. $.mockjax({ url: "/test", contentType: "text/json", responseText: { number: 14.0 } }); $.ajax({ url: "/test", dataType: "json" …
4imble
  • 13,979
  • 15
  • 70
  • 125