Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
test($resource): make test for function as param more explicit
Browse files Browse the repository at this point in the history
Related to aa8d783.

Closes #14820
  • Loading branch information
gkalpak committed Jun 27, 2016
1 parent 6050f0b commit f6c3b35
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/ngResource/resource.js
Expand Up @@ -116,7 +116,7 @@ function shallowClearAndCopy(src, dst) {
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
* `actions` methods. If a parameter value is a function, it will be called every time
* a param value needs to be obtained for a request (unless the param was overridden). The function
* will be passed the current data value as a argument.
* will be passed the current data value as an argument.
*
* Each key value in the parameter object is first bound to url template if present and then any
* excess keys are appended to the url search query after the `?`.
Expand Down Expand Up @@ -149,7 +149,7 @@ function shallowClearAndCopy(src, dst) {
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
* the parameter value is a function, it will be called every time when a param value needs to
* be obtained for a request (unless the param was overridden). The function will be passed the
* current data value as a argument.
* current data value as an argument.
* - **`url`** – {string} – action specific `url` override. The url templating is supported just
* like for the resource-level urls.
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
Expand Down
9 changes: 6 additions & 3 deletions test/ngResource/resourceSpec.js
Expand Up @@ -667,11 +667,14 @@ describe("basic usage", function() {

expect(fedor).toEqualData({id: 'fedor', email: 'f@f.com', count: 1});

$httpBackend.expect('POST', '/Person/fedor').respond(
{id: 'fedor', email: 'f@f.com', count: 2});
$httpBackend.expect('POST', '/Person/fedor2').respond(
{id: 'fedor2', email: 'f2@f.com', count: 2});

fedor.id = 'fedor2';
fedor.$save();
$httpBackend.flush();
expect(fedor).toEqualData({id: 'fedor', email: 'f@f.com', count: 2});

expect(fedor).toEqualData({id: 'fedor2', email: 'f2@f.com', count: 2});
});


Expand Down

0 comments on commit f6c3b35

Please sign in to comment.