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

test($resource): make test for function as param more explicit #14820

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ngResource/resource.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,14 @@ describe("basic usage", function() {

expect(fedor).toEqualData({id: 'fedor', email: '[email protected]', count: 1});

$httpBackend.expect('POST', '/Person/fedor').respond(
{id: 'fedor', email: '[email protected]', count: 2});
$httpBackend.expect('POST', '/Person/fedor2').respond(
{id: 'fedor2', email: '[email protected]', count: 2});

fedor.id = 'fedor2';
fedor.$save();
$httpBackend.flush();
expect(fedor).toEqualData({id: 'fedor', email: '[email protected]', count: 2});

expect(fedor).toEqualData({id: 'fedor2', email: '[email protected]', count: 2});
});


Expand Down