You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2013/08/20 23:45:06 UTC
[1/2] webworks commit: CB-4432 copyright notice change from Research
in Motion to Apache
Updated Branches:
refs/heads/master 7fd00940b -> 75b858568
CB-4432 copyright notice change from Research in Motion to Apache
Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/b33f6153
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/b33f6153
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/b33f6153
Branch: refs/heads/master
Commit: b33f6153d8360b798cd93b7fcadcb5781c1c486d
Parents: 7fd0094
Author: lorinbeer <lo...@adobe.com>
Authored: Tue Aug 20 14:42:14 2013 -0700
Committer: lorinbeer <lo...@adobe.com>
Committed: Tue Aug 20 14:42:14 2013 -0700
----------------------------------------------------------------------
blackberry10/framework/lib/config/default.js | 27 ++--
blackberry10/framework/lib/config/user.js | 27 ++--
.../framework/lib/events/applicationEvents.js | 27 ++--
.../framework/lib/events/deviceEvents.js | 27 ++--
blackberry10/framework/lib/plugins/event.js | 27 ++--
.../framework/lib/policy/folderAccess.js | 27 ++--
blackberry10/framework/lib/policy/whitelist.js | 27 ++--
blackberry10/framework/test/unit/lib/config.js | 30 ----
blackberry10/framework/test/unit/lib/event.js | 139 -------------------
.../test/unit/lib/events/applicationEvents.js | 27 ++--
.../test/unit/lib/events/deviceEvents.js | 27 ++--
11 files changed, 144 insertions(+), 268 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/lib/config/default.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/config/default.js b/blackberry10/framework/lib/config/default.js
index 31990b1..ad1a4a4 100644
--- a/blackberry10/framework/lib/config/default.js
+++ b/blackberry10/framework/lib/config/default.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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.
+ *
+*/
module.exports = {
configXML: "config.xml",
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/lib/config/user.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/config/user.js b/blackberry10/framework/lib/config/user.js
index 5e36885..48ebe0a 100644
--- a/blackberry10/framework/lib/config/user.js
+++ b/blackberry10/framework/lib/config/user.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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.
+ *
+*/
module.exports = {
authorEmail: "guocat@gmail.com",
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/lib/events/applicationEvents.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/events/applicationEvents.js b/blackberry10/framework/lib/events/applicationEvents.js
index 14a8f9e..d0b1b2e 100644
--- a/blackberry10/framework/lib/events/applicationEvents.js
+++ b/blackberry10/framework/lib/events/applicationEvents.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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.
+ *
+*/
module.exports = {
addEventListener: function (event, trigger) {
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/lib/events/deviceEvents.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/events/deviceEvents.js b/blackberry10/framework/lib/events/deviceEvents.js
index 939357b..744d5a4 100644
--- a/blackberry10/framework/lib/events/deviceEvents.js
+++ b/blackberry10/framework/lib/events/deviceEvents.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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.
+ *
+*/
module.exports = {
addEventListener: function (event, trigger) {
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/lib/plugins/event.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/plugins/event.js b/blackberry10/framework/lib/plugins/event.js
index 441bc70..0a97a49 100644
--- a/blackberry10/framework/lib/plugins/event.js
+++ b/blackberry10/framework/lib/plugins/event.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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 _event = require("../../lib/event"),
ONCE_EVENT_ERROR = "Error occured while adding once event listener.",
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/lib/policy/folderAccess.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/policy/folderAccess.js b/blackberry10/framework/lib/policy/folderAccess.js
index 5cd5690..b6e9f94 100644
--- a/blackberry10/framework/lib/policy/folderAccess.js
+++ b/blackberry10/framework/lib/policy/folderAccess.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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 util = require("../utils");
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/lib/policy/whitelist.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/lib/policy/whitelist.js b/blackberry10/framework/lib/policy/whitelist.js
index dcfbc3c..59905e5 100644
--- a/blackberry10/framework/lib/policy/whitelist.js
+++ b/blackberry10/framework/lib/policy/whitelist.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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 WebFolderAccess = require("./folderAccess").WebFolderAccess,
util = require("../utils");
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/test/unit/lib/config.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/test/unit/lib/config.js b/blackberry10/framework/test/unit/lib/config.js
index 64e8f7e..e69de29 100644
--- a/blackberry10/framework/test/unit/lib/config.js
+++ b/blackberry10/framework/test/unit/lib/config.js
@@ -1,30 +0,0 @@
-/*
- * Copyright 2010-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 srcPath = __dirname + '/../../../lib/';
-
-describe("Config", function () {
- var config = require(srcPath + 'config.js');
-
- it("verify user value is correctly mixed", function () {
- expect(config.copyright).toEqual("@Rebecca");
- });
-
- it("verify default value is correctly mixed", function () {
- expect(config.widgetExtensions).toEqual(null);
- });
-
-});
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/test/unit/lib/event.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/test/unit/lib/event.js b/blackberry10/framework/test/unit/lib/event.js
index 3d3e7fe..e69de29 100644
--- a/blackberry10/framework/test/unit/lib/event.js
+++ b/blackberry10/framework/test/unit/lib/event.js
@@ -1,139 +0,0 @@
-/*
- * Copyright 2010-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 libRoot = __dirname + "/../../../lib/";
-
-describe("lib/event", function () {
- var event = require(libRoot + "event"),
- webview = require(libRoot + "webview"),
- mockedWebview;
-
- beforeEach(function () {
- spyOn(webview, "executeJavascript");
- mockedWebview = {
- executeJavaScript: jasmine.createSpy(),
- id: (new Date()).getTime()
- };
- });
-
- describe("trigger", function () {
-
-
- it("will trigger on the content webview when no webview is registered (for backwards compatability)", function () {
- event.trigger("foo", {"id": 123});
- expect(mockedWebview.executeJavaScript).not.toHaveBeenCalled();
- expect(webview.executeJavascript).toHaveBeenCalled();
- });
-
- it("can invoke the webview execute javascript", function () {
- var data = {"id": 123};
- event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview);
- event.trigger("foo", data);
- expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([data]))) + "')");
- expect(webview.executeJavascript).not.toHaveBeenCalled();
- this.after(function () {
- event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview);
- });
- });
-
- it("sends multiple arguments passed in across as a JSONified array", function () {
- var args = [{"id": 123, "foo": "hello world", list: [1, 2, 3]}, "Grrrrrrr", "Arrrrg"];
- event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview);
- event.trigger.apply(null, ["foo"].concat(args));
- expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify(args))) + "')");
- expect(webview.executeJavascript).not.toHaveBeenCalled();
- this.after(function () {
- event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview);
- });
- });
-
- it("invokes on all webviews that have registered, but not those removed", function () {
- var mockedWebview2 = {
- executeJavaScript: jasmine.createSpy(),
- id: mockedWebview.id - 42
- },
- mockedWebview3 = {
- executeJavaScript: jasmine.createSpy(),
- id: mockedWebview.id + 42
- },
- mockedWebview4 = {
- executeJavaScript: jasmine.createSpy(),
- id: mockedWebview.id * 42
- };
- event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview);
- event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview2);
- event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview3);
- event.trigger("foo", {"id": 123});
- expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(mockedWebview2.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(mockedWebview3.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(mockedWebview4.executeJavaScript).not.toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(webview.executeJavascript).not.toHaveBeenCalled();
-
-
- event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview3);
- mockedWebview.executeJavaScript.reset();
- mockedWebview2.executeJavaScript.reset();
- mockedWebview3.executeJavaScript.reset();
- mockedWebview4.executeJavaScript.reset();
- event.trigger("foo", {"id": 123});
- expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(mockedWebview2.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(mockedWebview3.executeJavaScript).not.toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(mockedWebview4.executeJavaScript).not.toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
- expect(webview.executeJavascript).not.toHaveBeenCalled();
- this.after(function () {
- event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview);
- event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview2);
- });
- });
-
- });
-
- describe("add/remove would invoke action context", function () {
- var action = {
- context: {
- addEventListener: jasmine.createSpy(),
- removeEventListener: jasmine.createSpy()
- },
- event: "HELLO",
- trigger: function () {}
- };
-
- beforeEach(function () {
- action.context.addEventListener.reset();
- action.context.removeEventListener.reset();
- });
-
- it("can invoke action context add listener", function () {
- event.add(action, mockedWebview);
- expect(action.context.addEventListener).toHaveBeenCalledWith(action.event, action.trigger);
- });
-
- it("will not invoke action context add listener when the action has a once field", function () {
- action.once = true;
- event.add(action, mockedWebview);
- expect(action.context.addEventListener).not.toHaveBeenCalledWith(action.event, action.trigger);
- this.after(function () {
- delete action.once;
- });
- });
-
- it("can invoke action context remove listener", function () {
- event.remove(action, mockedWebview);
- expect(action.context.removeEventListener).toHaveBeenCalledWith(action.event, action.trigger);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/test/unit/lib/events/applicationEvents.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/test/unit/lib/events/applicationEvents.js b/blackberry10/framework/test/unit/lib/events/applicationEvents.js
index 81fa2e1..8f7f1a4 100644
--- a/blackberry10/framework/test/unit/lib/events/applicationEvents.js
+++ b/blackberry10/framework/test/unit/lib/events/applicationEvents.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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 _libDir = __dirname + "./../../../../lib/",
appEventPrefix = "application.",
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/b33f6153/blackberry10/framework/test/unit/lib/events/deviceEvents.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/test/unit/lib/events/deviceEvents.js b/blackberry10/framework/test/unit/lib/events/deviceEvents.js
index 2e55455..79161de 100644
--- a/blackberry10/framework/test/unit/lib/events/deviceEvents.js
+++ b/blackberry10/framework/test/unit/lib/events/deviceEvents.js
@@ -1,18 +1,23 @@
/*
- * Copyright 2010-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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ * 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.
- */
+ * 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 _libDir = __dirname + "./../../../../lib/",
deviceEventPrefix = "device.",
[2/2] webworks commit: reverted config.js and event.js in unit tests
due to bad overwrite
Posted by lo...@apache.org.
reverted config.js and event.js in unit tests due to bad overwrite
Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/75b85856
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/75b85856
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/75b85856
Branch: refs/heads/master
Commit: 75b8585688b505487d0a69bef7462bf5c7e9b782
Parents: b33f615
Author: lorinbeer <lo...@adobe.com>
Authored: Tue Aug 20 14:44:57 2013 -0700
Committer: lorinbeer <lo...@adobe.com>
Committed: Tue Aug 20 14:44:57 2013 -0700
----------------------------------------------------------------------
blackberry10/framework/test/unit/lib/config.js | 30 +++++
blackberry10/framework/test/unit/lib/event.js | 139 ++++++++++++++++++++
2 files changed, 169 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/75b85856/blackberry10/framework/test/unit/lib/config.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/test/unit/lib/config.js b/blackberry10/framework/test/unit/lib/config.js
index e69de29..64e8f7e 100644
--- a/blackberry10/framework/test/unit/lib/config.js
+++ b/blackberry10/framework/test/unit/lib/config.js
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2010-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 srcPath = __dirname + '/../../../lib/';
+
+describe("Config", function () {
+ var config = require(srcPath + 'config.js');
+
+ it("verify user value is correctly mixed", function () {
+ expect(config.copyright).toEqual("@Rebecca");
+ });
+
+ it("verify default value is correctly mixed", function () {
+ expect(config.widgetExtensions).toEqual(null);
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/75b85856/blackberry10/framework/test/unit/lib/event.js
----------------------------------------------------------------------
diff --git a/blackberry10/framework/test/unit/lib/event.js b/blackberry10/framework/test/unit/lib/event.js
index e69de29..3d3e7fe 100644
--- a/blackberry10/framework/test/unit/lib/event.js
+++ b/blackberry10/framework/test/unit/lib/event.js
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2010-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 libRoot = __dirname + "/../../../lib/";
+
+describe("lib/event", function () {
+ var event = require(libRoot + "event"),
+ webview = require(libRoot + "webview"),
+ mockedWebview;
+
+ beforeEach(function () {
+ spyOn(webview, "executeJavascript");
+ mockedWebview = {
+ executeJavaScript: jasmine.createSpy(),
+ id: (new Date()).getTime()
+ };
+ });
+
+ describe("trigger", function () {
+
+
+ it("will trigger on the content webview when no webview is registered (for backwards compatability)", function () {
+ event.trigger("foo", {"id": 123});
+ expect(mockedWebview.executeJavaScript).not.toHaveBeenCalled();
+ expect(webview.executeJavascript).toHaveBeenCalled();
+ });
+
+ it("can invoke the webview execute javascript", function () {
+ var data = {"id": 123};
+ event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview);
+ event.trigger("foo", data);
+ expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([data]))) + "')");
+ expect(webview.executeJavascript).not.toHaveBeenCalled();
+ this.after(function () {
+ event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview);
+ });
+ });
+
+ it("sends multiple arguments passed in across as a JSONified array", function () {
+ var args = [{"id": 123, "foo": "hello world", list: [1, 2, 3]}, "Grrrrrrr", "Arrrrg"];
+ event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview);
+ event.trigger.apply(null, ["foo"].concat(args));
+ expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify(args))) + "')");
+ expect(webview.executeJavascript).not.toHaveBeenCalled();
+ this.after(function () {
+ event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview);
+ });
+ });
+
+ it("invokes on all webviews that have registered, but not those removed", function () {
+ var mockedWebview2 = {
+ executeJavaScript: jasmine.createSpy(),
+ id: mockedWebview.id - 42
+ },
+ mockedWebview3 = {
+ executeJavaScript: jasmine.createSpy(),
+ id: mockedWebview.id + 42
+ },
+ mockedWebview4 = {
+ executeJavaScript: jasmine.createSpy(),
+ id: mockedWebview.id * 42
+ };
+ event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview);
+ event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview2);
+ event.add({event: "foo", context: {addEventListener: jasmine.createSpy()}}, mockedWebview3);
+ event.trigger("foo", {"id": 123});
+ expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(mockedWebview2.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(mockedWebview3.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(mockedWebview4.executeJavaScript).not.toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(webview.executeJavascript).not.toHaveBeenCalled();
+
+
+ event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview3);
+ mockedWebview.executeJavaScript.reset();
+ mockedWebview2.executeJavaScript.reset();
+ mockedWebview3.executeJavaScript.reset();
+ mockedWebview4.executeJavaScript.reset();
+ event.trigger("foo", {"id": 123});
+ expect(mockedWebview.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(mockedWebview2.executeJavaScript).toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(mockedWebview3.executeJavaScript).not.toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(mockedWebview4.executeJavaScript).not.toHaveBeenCalledWith("webworks.event.trigger('foo', '" + escape(encodeURIComponent(JSON.stringify([{"id": 123}]))) + "')");
+ expect(webview.executeJavascript).not.toHaveBeenCalled();
+ this.after(function () {
+ event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview);
+ event.remove({event: "foo", context: {removeEventListener: jasmine.createSpy()}}, mockedWebview2);
+ });
+ });
+
+ });
+
+ describe("add/remove would invoke action context", function () {
+ var action = {
+ context: {
+ addEventListener: jasmine.createSpy(),
+ removeEventListener: jasmine.createSpy()
+ },
+ event: "HELLO",
+ trigger: function () {}
+ };
+
+ beforeEach(function () {
+ action.context.addEventListener.reset();
+ action.context.removeEventListener.reset();
+ });
+
+ it("can invoke action context add listener", function () {
+ event.add(action, mockedWebview);
+ expect(action.context.addEventListener).toHaveBeenCalledWith(action.event, action.trigger);
+ });
+
+ it("will not invoke action context add listener when the action has a once field", function () {
+ action.once = true;
+ event.add(action, mockedWebview);
+ expect(action.context.addEventListener).not.toHaveBeenCalledWith(action.event, action.trigger);
+ this.after(function () {
+ delete action.once;
+ });
+ });
+
+ it("can invoke action context remove listener", function () {
+ event.remove(action, mockedWebview);
+ expect(action.context.removeEventListener).toHaveBeenCalledWith(action.event, action.trigger);
+ });
+ });
+});