mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 14:01:14 +08:00
Super basic test support for listing topics
This commit is contained in:
@ -225,6 +225,7 @@ Discourse = Ember.Application.createWithMixins({
|
||||
ajax: function() {
|
||||
|
||||
var url, args;
|
||||
|
||||
if (arguments.length === 1) {
|
||||
if (typeof arguments[0] === "string") {
|
||||
url = arguments[0];
|
||||
@ -246,6 +247,14 @@ Discourse = Ember.Application.createWithMixins({
|
||||
console.warning("DEPRECATION: Discourse.ajax should use promises, received 'error' callback");
|
||||
}
|
||||
|
||||
// If we have URL_FIXTURES, load from there instead (testing)
|
||||
var fixture = Discourse.URL_FIXTURES && Discourse.URL_FIXTURES[url];
|
||||
if (fixture) {
|
||||
return Ember.Deferred.promise(function(promise) {
|
||||
promise.resolve(fixture);
|
||||
})
|
||||
}
|
||||
|
||||
return Ember.Deferred.promise(function (promise) {
|
||||
var oldSuccess = args.success;
|
||||
args.success = function(xhr) {
|
||||
|
Reference in New Issue
Block a user