mirror of https://gitee.com/bigwinds/arangodb
A frontend foxx model can now request it's configuration information
This commit is contained in:
parent
368f78cda1
commit
fd4d9ec116
|
@ -39,6 +39,21 @@
|
|||
callback(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getConfiguration: function(callback) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/_admin/aardvark/foxxes/config?mount=" + this.encodedMount(),
|
||||
contentType: "application/json",
|
||||
processData: false,
|
||||
success: function(data) {
|
||||
callback(data);
|
||||
},
|
||||
error: function(err) {
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*jshint browser: true */
|
||||
/*jshint unused: false */
|
||||
/*global describe, beforeEach, afterEach, it, spyOn, expect*/
|
||||
/*global $*/
|
||||
/*global $, jasmine*/
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
|
@ -35,6 +35,32 @@
|
|||
var myFoxx = new window.Foxx();
|
||||
expect(myFoxx.isNew()).toBeFalsy();
|
||||
});
|
||||
|
||||
it("can get it's configuration", function() {
|
||||
var data = {
|
||||
opt1: {
|
||||
type: "string",
|
||||
description: "Option description",
|
||||
default: "empty",
|
||||
current: "empty"
|
||||
}
|
||||
};
|
||||
var testMount = "/this/is_/a/test/mount";
|
||||
var myFoxx = new window.Foxx({
|
||||
mount: testMount
|
||||
});
|
||||
spyOn($, "ajax").andCallFake(function(opts) {
|
||||
expect(opts.url).toEqual("/_admin/aardvark/foxxes/config?mount=" + myFoxx.encodedMount());
|
||||
expect(opts.type).toEqual("GET");
|
||||
expect(opts.success).toEqual(jasmine.any(Function));
|
||||
expect(opts.error).toEqual(jasmine.any(Function));
|
||||
opts.success(data);
|
||||
});
|
||||
myFoxx.getConfiguration(function(result) {
|
||||
expect(result).toEqual(data);
|
||||
});
|
||||
expect($.ajax).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
|
|
Loading…
Reference in New Issue