fixed webworks pim.category namespace to hang off pim namespace
diff --git a/lib/ripple/platform/webworks/2.0.0/client/category.js b/lib/ripple/platform/webworks/2.0.0/client/category.js
new file mode 100644
index 0000000..798b03d
--- /dev/null
+++ b/lib/ripple/platform/webworks/2.0.0/client/category.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+var transport = require('ripple/platform/webworks/2.0.0/client/transport'),
+ _uri = "blackberry/pim/category/",
+ _self;
+
+_self = {
+ addCategory: function (categoryName) {
+ transport.call(_uri + "addCategory", {
+ get: {categoryName: categoryName}
+ });
+ },
+ deleteCategory: function (categoryName) {
+ transport.call(_uri + "deleteCategory", {
+ get: {categoryName: categoryName}
+ });
+ },
+ getCategories: function () {
+ return transport.call(_uri + "getCategories");
+ }
+};
+
+module.exports = _self;
diff --git a/lib/ripple/platform/webworks/2.0.0/client/pim.js b/lib/ripple/platform/webworks/2.0.0/client/pim.js
index 798b03d..d2272b6 100644
--- a/lib/ripple/platform/webworks/2.0.0/client/pim.js
+++ b/lib/ripple/platform/webworks/2.0.0/client/pim.js
@@ -1,6 +1,6 @@
/*
* Copyright 2011 Research In Motion Limited.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -13,24 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-var transport = require('ripple/platform/webworks/2.0.0/client/transport'),
- _uri = "blackberry/pim/category/",
- _self;
-
-_self = {
- addCategory: function (categoryName) {
- transport.call(_uri + "addCategory", {
- get: {categoryName: categoryName}
- });
- },
- deleteCategory: function (categoryName) {
- transport.call(_uri + "deleteCategory", {
- get: {categoryName: categoryName}
- });
- },
- getCategories: function () {
- return transport.call(_uri + "getCategories");
- }
-};
-
-module.exports = _self;
+module.exports = {};
diff --git a/lib/ripple/platform/webworks/2.0.0/spec.js b/lib/ripple/platform/webworks/2.0.0/spec.js
index d2070d3..aeffdc7 100644
--- a/lib/ripple/platform/webworks/2.0.0/spec.js
+++ b/lib/ripple/platform/webworks/2.0.0/spec.js
@@ -52,8 +52,12 @@
children: {
pim: {
path: "webworks/2.0.0/client/pim",
- feature: "blackberry.pim.Task|blackberry.pim.Recurrence|blackberry.pim.Reminder|blackberry.pim.Appointment|blackberry.pim.Address|blackberry.pim.Attendee|blackberry.pim.Memo|blackberry.pim.Contact",
+ feature: "blackberry.pim.category|blackberry.pim.Task|blackberry.pim.Recurrence|blackberry.pim.Reminder|blackberry.pim.Appointment|blackberry.pim.Address|blackberry.pim.Attendee|blackberry.pim.Memo|blackberry.pim.Contact",
children: {
+ category: {
+ path: "webworks/2.0.0/client/category",
+ feature: "blackberry.pim.category"
+ },
Task: {
path: "webworks/2.0.0/client/Task",
feature: "blackberry.pim.Task"
diff --git a/test/webworks/category.js b/test/webworks/category.js
index bac1243..5de9b14 100644
--- a/test/webworks/category.js
+++ b/test/webworks/category.js
@@ -15,8 +15,8 @@
*/
describe("webworks pim.category", function () {
- var pim = require('ripple/platform/webworks/2.0.0/client/pim'),
- category = require('ripple/platform/webworks/2.0.0/server/category'),
+ var categoryClient = require('ripple/platform/webworks/2.0.0/client/category'),
+ categoryServer = require('ripple/platform/webworks/2.0.0/server/category'),
spec = require('ripple/platform/webworks/2.0.0/spec'),
transport = require('ripple/platform/webworks/2.0.0/client/transport'),
webworks = require('ripple/platform/webworks/2.0.0/server'),
@@ -25,14 +25,14 @@
describe("server index", function () {
it("exposes the category module", function () {
- expect(webworks.blackberry.pim.category).toEqual(category);
+ expect(webworks.blackberry.pim.category).toEqual(categoryServer);
});
});
describe("platform spec", function () {
it("includes the module according to proper object structure", function () {
- expect(spec.objects.blackberry.children.pim.path)
- .toEqual("webworks/2.0.0/client/pim");
+ expect(spec.objects.blackberry.children.pim.children.category.path)
+ .toEqual("webworks/2.0.0/client/category");
});
});
@@ -40,7 +40,7 @@
describe("addCategory", function () {
it("calls the transport with proper args", function () {
spyOn(transport, "call");
- pim.addCategory("x");
+ categoryClient.addCategory("x");
expect(transport.call)
.toHaveBeenCalledWith("blackberry/pim/category/addCategory", {get: {categoryName: "x"}});
});
@@ -49,7 +49,7 @@
describe("deleteCategory", function () {
it("calls the transport with proper args", function () {
spyOn(transport, "call");
- pim.deleteCategory("y");
+ categoryClient.deleteCategory("y");
expect(transport.call)
.toHaveBeenCalledWith("blackberry/pim/category/deleteCategory", {get: {categoryName: "y"}});
});
@@ -58,7 +58,7 @@
describe("getCategories", function () {
it("calls the transport with proper args", function () {
spyOn(transport, "call").andReturn("z");
- expect(pim.getCategories()).toEqual("z");
+ expect(categoryClient.getCategories()).toEqual("z");
expect(transport.call)
.toHaveBeenCalledWith("blackberry/pim/category/getCategories");
});
@@ -71,7 +71,7 @@
it("returns the current list of categories", function () {
var categories = [];
spyOn(db, "retrieveObject").andReturn(categories);
- expect(category.getCategories().data).toEqual(categories);
+ expect(categoryServer.getCategories().data).toEqual(categories);
});
});
@@ -85,14 +85,14 @@
});
it("adds categories", function () {
- category.addCategory({categoryName: "people"});
- category.addCategory({categoryName: "fun people"});
+ categoryServer.addCategory({categoryName: "people"});
+ categoryServer.addCategory({categoryName: "fun people"});
expect(categories.length).toEqual(2);
expect(categories).toEqual(["people", "fun people"]);
});
it("persists the category", function () {
- category.addCategory({categoryName: "more fun people"});
+ categoryServer.addCategory({categoryName: "more fun people"});
expect(db.saveObject).toHaveBeenCalledWith("blackberry-pim-category", ["more fun people"]);
});
});
@@ -107,15 +107,15 @@
});
it("deletes a category", function () {
- category.addCategory({categoryName: "the beautiful people"});
- category.deleteCategory({categoryName: "the beautiful people"});
+ categoryServer.addCategory({categoryName: "the beautiful people"});
+ categoryServer.deleteCategory({categoryName: "the beautiful people"});
expect(categories.length).toEqual(0);
expect(categories).toEqual([]);
});
it("persists the new category list", function () {
- category.addCategory({categoryName: "name"});
- category.deleteCategory({categoryName: "name"});
+ categoryServer.addCategory({categoryName: "name"});
+ categoryServer.deleteCategory({categoryName: "name"});
expect(db.saveObject).toHaveBeenCalledWith("blackberry-pim-category", []);
});
});