-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/product-sprint6-staging' into pr…
…oduct-sprint6-173-merger
- Loading branch information
Showing
14 changed files
with
639 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
app.repo("UserRepo", function UserRepo(WsApi) { | ||
|
||
this.getUser = function () { | ||
return WsApi.fetch(this.mapping.getUser); | ||
}; | ||
var userRepo = this; | ||
|
||
return this; | ||
userRepo.getUser = function () { | ||
return WsApi.fetch(this.mapping.getUser); | ||
}; | ||
|
||
}); | ||
return userRepo; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
var mockModel = function (modelName, $q, mockDataObj) { | ||
var model = {}; | ||
var shadow = {}; | ||
var combinationOperation = ""; | ||
|
||
model.isDirty = false; | ||
model.isValid = false; | ||
|
||
model.mock = function (toMock) { | ||
if (typeof toMock === "object") { | ||
var keys = Object.keys(toMock); | ||
for (var i in keys) { | ||
model[keys[i]] = toMock[keys[i]]; | ||
} | ||
} else if (toMock === undefined || toMock === null) { | ||
model = null; | ||
} | ||
}; | ||
|
||
model.mockShadow = function (toMock) { | ||
shadow = toMock; | ||
}; | ||
|
||
model.acceptPendingUpdate = function () { | ||
}; | ||
|
||
model.acceptPendingDelete = function () { | ||
}; | ||
|
||
model.before = function () { | ||
}; | ||
|
||
model.clearListens = function () { | ||
var payload = {}; | ||
return payloadPromise($q.defer(), payload); | ||
}; | ||
|
||
model.clearValidationResults = function () { | ||
}; | ||
|
||
model.delete = function () { | ||
return payloadPromise($q.defer(), true); | ||
}; | ||
|
||
model.dirty = function (boolean) { | ||
if (boolean !== undefined) { | ||
model.isDirty = boolean; | ||
} | ||
|
||
return model.isDirty; | ||
}; | ||
|
||
model.enableMergeCombinationOperation = function () { | ||
combinationOperation = "merge"; | ||
}; | ||
|
||
model.enableExtendCombinationOperation = function () { | ||
combinationOperation = "extend"; | ||
}; | ||
|
||
model.fetch = function () { | ||
return payloadPromise($q.defer(), mockDataObj); | ||
}; | ||
|
||
model.getCombinationOperation = function () { | ||
return combinationOperation; | ||
}; | ||
|
||
model.getEntityName = function () { | ||
return modelName; | ||
}; | ||
|
||
model.getValidations = function () { | ||
return null; | ||
}; | ||
|
||
model.init = function (data, apiMapping) { | ||
}; | ||
|
||
model.listen = function () { | ||
}; | ||
|
||
model.ready = function () { | ||
var defer = $q.defer(); | ||
defer.resolve(); | ||
return defer.promise; | ||
}; | ||
|
||
model.refresh = function () { | ||
angular.extend(model, shadow); | ||
}; | ||
|
||
model.reload = function () { | ||
var defer = $q.defer(); | ||
defer.resolve(model); | ||
return defer.promise; | ||
}; | ||
|
||
model.save = function () { | ||
return payloadPromise($q.defer(), true); | ||
}; | ||
|
||
model._syncShadow = function () { | ||
model.isDirty = false; | ||
shadow = angular.copy(model); | ||
}; | ||
|
||
model.mock(mockDataObj); | ||
model._syncShadow(); | ||
|
||
return model; | ||
}; |
Oops, something went wrong.