You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by da...@apache.org on 2017/07/26 06:46:09 UTC

[06/12] incubator-weex git commit: + [html5] add webview unit test case

+ [html5] add webview unit test case


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6f74e008
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6f74e008
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6f74e008

Branch: refs/heads/0.16-dev
Commit: 6f74e0089ae1b0cf0a9d55d3f87b723a0386a6a6
Parents: 01ada82
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 25 21:15:42 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 25 21:15:42 2017 +0800

----------------------------------------------------------------------
 html5/test/render/vue/modules/webview.js | 48 +++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6f74e008/html5/test/render/vue/modules/webview.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/webview.js b/html5/test/render/vue/modules/webview.js
new file mode 100644
index 0000000..f56421f
--- /dev/null
+++ b/html5/test/render/vue/modules/webview.js
@@ -0,0 +1,48 @@
+/*
+ * 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
+ *
+ * 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.
+ */
+import * as webview from '../../../../render/vue/modules/webview'
+
+describe('webview module', () => {
+  const gobackSpy = sinon.spy()
+  const reloadSpy = sinon.spy()
+  const goforwardSpy = sinon.spy()
+  const vnode = {
+    goBack: gobackSpy,
+    reload: reloadSpy,
+    goForward: goforwardSpy
+  }
+  it('should goBack be worked', () => {
+      const { goBack } = webview.default
+      expect(goBack).to.be.a('function')
+      goBack([vnode])
+      expect(gobackSpy.callCount).to.be.equal(1)
+  })
+  it('should reload be worked', () => {
+      const { reload } = webview.default
+      expect(reload).to.be.a('function')
+      reload([vnode])
+      expect(reloadSpy.callCount).to.be.equal(1)
+  })
+  it('should goForward be worked', () => {
+      const { goForward } = webview.default
+      expect(goForward).to.be.a('function')
+      goForward([vnode])
+      expect(goforwardSpy.callCount).to.be.equal(1)
+  })
+})
\ No newline at end of file