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/20 08:29:43 UTC
[13/50] incubator-weex git commit: * [html5] merge open && close &&
message
* [html5] merge open && close && message
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/bca5422d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/bca5422d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/bca5422d
Branch: refs/heads/0.15-dev
Commit: bca5422d4a7223803ef1252b542f33e1a0680be5
Parents: 57599bd
Author: erha19 <fa...@gmail.com>
Authored: Tue Jul 11 15:51:01 2017 +0800
Committer: erha19 <fa...@gmail.com>
Committed: Tue Jul 11 15:51:01 2017 +0800
----------------------------------------------------------------------
html5/test/render/vue/modules/websocket.js | 28 ++++++-------------------
1 file changed, 6 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/bca5422d/html5/test/render/vue/modules/websocket.js
----------------------------------------------------------------------
diff --git a/html5/test/render/vue/modules/websocket.js b/html5/test/render/vue/modules/websocket.js
index fa6f757..1a18294 100644
--- a/html5/test/render/vue/modules/websocket.js
+++ b/html5/test/render/vue/modules/websocket.js
@@ -21,13 +21,6 @@ import websocket from '../../../../render/vue/modules/websocket/websocket'
const TestUrl = 'ws://echo.websocket.org'
/** @test {webSocket module} */
describe('webSocket module', function () {
- after(function (done) {
- const ws = new WebSocket(TestUrl)
- ws.addEventListener('open', function () {
- ws.send('shutdown')
- done()
- })
- })
describe('extends Standard WebSocket API', function () {
context('should inherit', function () {
const ws = websocket.WebSocket(TestUrl)
@@ -54,33 +47,24 @@ describe('webSocket module', function () {
context('should forward native events', function () {
let ws = null
beforeEach(function () {
- ws = websocket.WebSocket(TestUrl)
+ ws = websocket.WebSocket(TestUrl,'')
})
afterEach(function () {
websocket.close()
})
- it('open', function (done) {
- websocket.onopen = function () {
- done()
- }
- })
- it('close', function (done) {
+ it('open && message && close', function (done) {
let closed = false
+ const message = 'Test'
ws.onclose = function () {
if (!closed) {
- done()
closed = true
}
+ expect(closed).to.be.true
+ done()
}
- websocket.onopen = function () {
- websocket.close()
- }
- })
- it('message', function (done) {
- const message = 'Test'
websocket.onmessage = function (e) {
expect(e.data).to.be.equal(message)
- done()
+ websocket.close()
}
websocket.onopen = function () {
websocket.send(message)