Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Livedoc open #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
20 changes: 18 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,24 @@ module.exports = function(grunt) {
livedoc: {
command: 'yuidoc --server 3000 --config yuidoc.json',
options: {
async: true,
execOptions: { detached: true },
stdout: true,
stderr: true
}
}
},
open : {
livedoc: {
path: 'http://127.0.0.1:3000/'
}
},
wait: {
livedoc: {
options: {
delay: 7000
}
}
}
});

Expand All @@ -119,13 +133,15 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-istanbul');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.loadNpmTasks('grunt-wait');
grunt.loadNpmTasks('grunt-open');

grunt.registerTask('hint', ['jshint']);
grunt.registerTask('build', ['jshint', 'requirejs']);
grunt.registerTask('test', ['jshint', 'jasmine:test'] );
grunt.registerTask('coverage', ['jshint', 'instrument', 'jasmine:coverage'] );
grunt.registerTask('doc', ['yuidoc'] );
grunt.registerTask('livedoc', ['shell:livedoc'] );
grunt.registerTask('livedoc', ['shell:livedoc', 'wait:livedoc', 'open:livedoc'] );

};
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.0",
"glob": "~3.2.1",
"grunt-shell": "~0.3.1",
"grunt-contrib-yuidoc": "~0.4.0",
"q": "~0.9.7",
"grunt-requirejs": "~0.4.0",
"grunt-template-jasmine-istanbul": "~0.2.5",
"grunt-template-jasmine-requirejs": "~0.1.7",
"grunt-contrib-jasmine": "~0.5.2",
"grunt-istanbul": "~0.2.3"

"grunt-istanbul": "~0.2.3",
"grunt-shell-spawn": "~0.3.0",
"grunt-wait": "~0.1.0",
"grunt-open": "~0.2.2"
},
"scripts": {
"test": "grunt test --verbose"
Expand Down
4 changes: 0 additions & 4 deletions src/ConnectionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,6 @@ define(["structures/Response", "structures/Request", "structures/CAPIError"],
* @param callback
*/
ConnectionManager.prototype.delete = function (url, callback) {
// default values for all the parameters
url = (typeof url === "undefined") ? "/" : url;
callback = (typeof callback === "undefined") ? function () {} : callback;

this.request(
"DELETE",
url,
Expand Down
12 changes: 8 additions & 4 deletions test/CAPI.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ define(function (require) {
anotherContentService,
anotherContentTypeService,
anotherUserService,
testOptions = {
logRequests: true,
rootPath: '/testrootpath/',
connectionStack: []
testOptions,
TestOptionsObject = function () {
this.logRequests = true;
this.rootPath = '/testrootpath/';
this.connectionStack = [];
};

TestOptionsObject.prototype.dummyProperty = "dummy prototype property";
testOptions = new TestOptionsObject();

beforeEach(function () {
mockAuthenticationAgent = {
_CAPI: null,
Expand Down
15 changes: 0 additions & 15 deletions test/ConnectionManager.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,21 +335,6 @@ define(function (require) {
);
});

it("delete (with minimum arguments set)", function(){

connectionManager.delete(
undefined,
undefined
);

expect(mockAuthenticationAgent.ensureAuthentication).toHaveBeenCalled();
expect(mockAuthenticationAgent.authenticateRequest).toHaveBeenCalled();
expect(mockConnection.execute).toHaveBeenCalledWith(
jasmine.any(Request),
jasmine.any(Function)
);
});

it("logOut", function(){

connectionManager.logOut(mockCallback);
Expand Down
32 changes: 16 additions & 16 deletions test/ContentService.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ define(function (require) {
);

updateStruct.body.ContentUpdate.Section = "/api/ezp/v2/content/sections/2";
updateStruct.body.ContentUpdate.remoteId = "random-id-" + Math.random()*1000000;
updateStruct.body.ContentUpdate.remoteId = "random-id-";

contentService.updateContentMetadata(
testContentId,
Expand Down Expand Up @@ -494,7 +494,7 @@ define(function (require) {
fieldInfo = {
"fieldDefinitionIdentifier": "title",
"languageCode": "eng-US",
"fieldValue": "This is a new title" + Math.random()*1000000
"fieldValue": "This is a new title"
};

contentUpdateStruct.body.VersionUpdate.fields.field.push(fieldInfo);
Expand Down Expand Up @@ -790,7 +790,7 @@ define(function (require) {

it("updateLocation", function () {
var locationUpdateStruct = contentService.newLocationUpdateStruct();
locationUpdateStruct.remoteId = "random-remote-id-" + Math.random()*100000;
locationUpdateStruct.remoteId = "random-remote-id-";

contentService.updateLocation(
testLocation,
Expand Down Expand Up @@ -998,8 +998,8 @@ define(function (require) {

it("createSection", function () {
var sectionInputStruct = contentService.newSectionInputStruct(
"testSection" + Math.random()*1000000,
"Test Section " + Math.round(Math.random()*1000)
"testSection",
"Test Section"
);

contentService.createSection(
Expand All @@ -1020,8 +1020,8 @@ define(function (require) {

it("updateSection", function () {
var sectionInputStruct = new SectionInputStruct(
"testSection" + Math.random()*1000000,
"Test Section " + Math.round(Math.random()*1000)
"testSection",
"Test Section"
);

contentService.updateSection(
Expand Down Expand Up @@ -1234,12 +1234,12 @@ define(function (require) {

it("createObjectStateGroup", function () {
var objectStateGroupCreateStruct = contentService.newObjectStateGroupCreateStruct(
"some-id" + Math.random(10000),
"some-id",
"eng-US",
[
{
"_languageCode":"eng-US",
"#text":"Some Name " + Math.random(10000)
"#text":"Some Name"
}
]
);
Expand All @@ -1263,7 +1263,7 @@ define(function (require) {
it("updateObjectStateGroup", function () {
var objectStateGroupUpdateStruct = contentService.newObjectStateGroupUpdateStruct();

objectStateGroupUpdateStruct.body.ObjectStateGroupUpdate.identifier = "some-id" + Math.random(10000);
objectStateGroupUpdateStruct.body.ObjectStateGroupUpdate.identifier = "some-id";

contentService.updateObjectStateGroup(
testObjectStateGroup,
Expand Down Expand Up @@ -1333,13 +1333,13 @@ define(function (require) {

it("createObjectState", function () {
var objectStateCreateStruct = contentService.newObjectStateCreateStruct(
"some-id" + Math.random(10000),
"some-id",
"eng-US",
0,
[
{
"_languageCode":"eng-US",
"#text":"Some Name " + Math.random(10000)
"#text":"Some Name"
}
],
[]
Expand All @@ -1363,7 +1363,7 @@ define(function (require) {
it("updateObjectState", function () {
var objectStateUpdateStruct = contentService.newObjectStateUpdateStruct();

objectStateUpdateStruct.body.ObjectStateUpdate.identifier = "some-id" + Math.random(10000);
objectStateUpdateStruct.body.ObjectStateUpdate.identifier = "some-id";

contentService.updateObjectState(
testObjectState,
Expand Down Expand Up @@ -1579,7 +1579,7 @@ define(function (require) {

it("createUrlWildCard", function () {
var urlWildcardCreateStruct = contentService.newUrlWildcardCreateStruct(
"some-new-wildcard-" + Math.random(100) * 1000,
"some-new-wildcard",
"testLocation",
"false"
);
Expand Down Expand Up @@ -1827,8 +1827,8 @@ define(function (require) {

it("createSection", function () {
var sectionInputStruct = new SectionInputStruct(
"testSection" + Math.random()*1000000,
"Test Section " + Math.round(Math.random()*1000)
"testSection",
"Test Section"
);

contentService.createSection(
Expand Down
Loading