Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
f0c40a18
Commit
f0c40a18
authored
Nov 19, 2014
by
Wandenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements to run javascript tests on IE8
parent
9f47902e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
30 deletions
+69
-30
PushStreamSpec.js
misc/spec/javascripts/PushStreamSpec.js
+7
-3
UtilsSpec.js
misc/spec/javascripts/UtilsSpec.js
+27
-27
SpecHelper.js
misc/spec/javascripts/helpers/SpecHelper.js
+35
-0
No files found.
misc/spec/javascripts/PushStreamSpec.js
View file @
f0c40a18
...
...
@@ -538,7 +538,7 @@ describe("PushStream", function() {
waitsFor
(
function
()
{
return
error
!==
null
;
},
"
The callback was not called
"
,
1
000
);
},
"
The callback was not called
"
,
3
000
);
runs
(
function
()
{
expect
(
pushstream
.
readyState
).
toBe
(
PushStream
.
CLOSED
);
...
...
@@ -1011,11 +1011,15 @@ describe("PushStream", function() {
});
describe
(
"
on EventSource mode
"
,
function
()
{
if
(
window
.
EventSource
)
{
itShouldHaveCommonBehavior
(
'
eventsource
'
);
}
});
describe
(
"
on WebSocket mode
"
,
function
()
{
if
(
window
.
WebSocket
||
window
.
MozWebSocket
)
{
itShouldHaveCommonBehavior
(
'
websocket
'
);
}
});
describe
(
"
on LongPolling mode
"
,
function
()
{
...
...
misc/spec/javascripts/UtilsSpec.js
View file @
f0c40a18
...
...
@@ -13,48 +13,48 @@ describe("Utils", function() {
describe
(
"
when formatting dates to UTC string
"
,
function
()
{
it
(
"
should return the string with two digits for day
"
,
function
()
{
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-09T12:00:00-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 15:00:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-10T12:00:00-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 15:00:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-09T12:00:00-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 15:00:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-10T12:00:00-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 15:00:00 GMT
"
);
});
it
(
"
should return the string with two digits for hour
"
,
function
()
{
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-09T06:00:00-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:00:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-10T07:00:00-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 10:00:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-09T06:00:00-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:00:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-10T07:00:00-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 10:00:00 GMT
"
);
});
it
(
"
should return the string with two digits for minute
"
,
function
()
{
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-09T06:09:00-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:09:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-10T07:10:00-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 10:10:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-09T06:09:00-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:09:00 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-10T07:10:00-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 10:10:00 GMT
"
);
});
it
(
"
should return the string with two digits for second
"
,
function
()
{
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-09T06:09:09-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-10T07:10:10-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 10:10:10 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-09T06:09:09-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-10T07:10:10-03:00
"
))).
toBe
(
"
Sat, 10 Nov 2012 10:10:10 GMT
"
);
});
it
(
"
should return the right text for months
"
,
function
()
{
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-09T06:09:09-03:00
"
))).
toBe
(
"
Mon, 09 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-02-09T06:09:09-03:00
"
))).
toBe
(
"
Thu, 09 Feb 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-03-09T06:09:09-03:00
"
))).
toBe
(
"
Fri, 09 Mar 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-04-09T06:09:09-03:00
"
))).
toBe
(
"
Mon, 09 Apr 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-05-09T06:09:09-03:00
"
))).
toBe
(
"
Wed, 09 May 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-06-09T06:09:09-03:00
"
))).
toBe
(
"
Sat, 09 Jun 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-07-09T06:09:09-03:00
"
))).
toBe
(
"
Mon, 09 Jul 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-08-09T06:09:09-03:00
"
))).
toBe
(
"
Thu, 09 Aug 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-09-09T06:09:09-03:00
"
))).
toBe
(
"
Sun, 09 Sep 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-10-09T06:09:09-03:00
"
))).
toBe
(
"
Tue, 09 Oct 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-11-09T06:09:09-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-12-09T06:09:09-03:00
"
))).
toBe
(
"
Sun, 09 Dec 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-09T06:09:09-03:00
"
))).
toBe
(
"
Mon, 09 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-02-09T06:09:09-03:00
"
))).
toBe
(
"
Thu, 09 Feb 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-03-09T06:09:09-03:00
"
))).
toBe
(
"
Fri, 09 Mar 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-04-09T06:09:09-03:00
"
))).
toBe
(
"
Mon, 09 Apr 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-05-09T06:09:09-03:00
"
))).
toBe
(
"
Wed, 09 May 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-06-09T06:09:09-03:00
"
))).
toBe
(
"
Sat, 09 Jun 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-07-09T06:09:09-03:00
"
))).
toBe
(
"
Mon, 09 Jul 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-08-09T06:09:09-03:00
"
))).
toBe
(
"
Thu, 09 Aug 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-09-09T06:09:09-03:00
"
))).
toBe
(
"
Sun, 09 Sep 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-10-09T06:09:09-03:00
"
))).
toBe
(
"
Tue, 09 Oct 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-11-09T06:09:09-03:00
"
))).
toBe
(
"
Fri, 09 Nov 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-12-09T06:09:09-03:00
"
))).
toBe
(
"
Sun, 09 Dec 2012 09:09:09 GMT
"
);
});
it
(
"
should return the right text for days
"
,
function
()
{
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-01T06:09:09-03:00
"
))).
toBe
(
"
Sun, 01 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-02T06:09:09-03:00
"
))).
toBe
(
"
Mon, 02 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-03T06:09:09-03:00
"
))).
toBe
(
"
Tue, 03 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-04T06:09:09-03:00
"
))).
toBe
(
"
Wed, 04 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-05T06:09:09-03:00
"
))).
toBe
(
"
Thu, 05 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-06T06:09:09-03:00
"
))).
toBe
(
"
Fri, 06 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
new
Date
(
"
2012-01-07T06:09:09-03:00
"
))).
toBe
(
"
Sat, 07 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-01T06:09:09-03:00
"
))).
toBe
(
"
Sun, 01 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-02T06:09:09-03:00
"
))).
toBe
(
"
Mon, 02 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-03T06:09:09-03:00
"
))).
toBe
(
"
Tue, 03 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-04T06:09:09-03:00
"
))).
toBe
(
"
Wed, 04 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-05T06:09:09-03:00
"
))).
toBe
(
"
Thu, 05 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-06T06:09:09-03:00
"
))).
toBe
(
"
Fri, 06 Jan 2012 09:09:09 GMT
"
);
expect
(
Utils
.
dateToUTCString
(
Date
.
fromISO
(
"
2012-01-07T06:09:09-03:00
"
))).
toBe
(
"
Sat, 07 Jan 2012 09:09:09 GMT
"
);
});
});
...
...
misc/spec/javascripts/helpers/SpecHelper.js
View file @
f0c40a18
...
...
@@ -2,3 +2,38 @@ beforeEach(function() {
this
.
addMatchers
({
});
});
(
function
()
{
var
D
=
new
Date
(
'
2011-06-02T09:34:29+02:00
'
);
if
(
!
D
||
+
D
!==
1307000069000
)
{
Date
.
fromISO
=
function
(
s
)
{
var
day
,
tz
,
rx
=
/^
(\d{4}\-\d\d\-\d\d([
tT
][\d
:
\.]
*
)?)([
zZ
]
|
([
+
\-])(\d\d)
:
(\d\d))?
$/
,
p
=
rx
.
exec
(
s
)
||
[];
if
(
p
[
1
])
{
day
=
p
[
1
].
split
(
/
\D
/
);
for
(
var
i
=
0
,
L
=
day
.
length
;
i
<
L
;
i
++
)
{
day
[
i
]
=
parseInt
(
day
[
i
],
10
)
||
0
;
};
day
[
1
]
-=
1
;
day
=
new
Date
(
Date
.
UTC
.
apply
(
Date
,
day
));
if
(
!
day
.
getDate
())
return
NaN
;
if
(
p
[
5
])
{
tz
=
(
parseInt
(
p
[
5
],
10
)
*
60
);
if
(
p
[
6
])
tz
+=
parseInt
(
p
[
6
],
10
);
if
(
p
[
4
]
==
'
+
'
)
tz
*=
-
1
;
if
(
tz
)
day
.
setUTCMinutes
(
day
.
getUTCMinutes
()
+
tz
);
}
return
day
;
}
return
NaN
;
};
}
else
{
Date
.
fromISO
=
function
(
s
)
{
return
new
Date
(
s
);
};
}
})();
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment