Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
matrix-js-sdk
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Matrix.org
matrix-js-sdk
Commits
e6e2f0b3
Commit
e6e2f0b3
authored
Jun 12, 2017
by
Luke Barnard
Browse files
Options
Downloads
Patches
Plain Diff
Fix the tests such that they mock EventTimelineSet.prototype.getTimelineForEvent
parent
1a0e480b
Branches
246-creating-room-state
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/unit/timeline-window.spec.js
+22
-9
22 additions, 9 deletions
spec/unit/timeline-window.spec.js
with
22 additions
and
9 deletions
spec/unit/timeline-window.spec.js
+
22
−
9
View file @
e6e2f0b3
...
@@ -12,6 +12,22 @@ import expect from 'expect';
...
@@ -12,6 +12,22 @@ import expect from 'expect';
const
ROOM_ID
=
"
roomId
"
;
const
ROOM_ID
=
"
roomId
"
;
const
USER_ID
=
"
userId
"
;
const
USER_ID
=
"
userId
"
;
function
createTimelineSet
()
{
// XXX: this is a horrid hack
return
{
room
:
{
roomId
:
ROOM_ID
,
getUnfilteredTimelineSet
:
function
()
{
return
this
;
},
},
getTimelineForEvent
:
function
()
{
return
this
.
timeline
;
},
timeline
:
null
,
// Must be set after creation
};
}
/*
/*
* create a timeline with a bunch (default 3) events.
* create a timeline with a bunch (default 3) events.
* baseIndex is 1 by default.
* baseIndex is 1 by default.
...
@@ -24,13 +40,9 @@ function createTimeline(numEvents, baseIndex) {
...
@@ -24,13 +40,9 @@ function createTimeline(numEvents, baseIndex) {
baseIndex
=
1
;
baseIndex
=
1
;
}
}
// XXX: this is a horrid hack
const
timelineSet
=
createTimelineSet
();
const
timelineSet
=
{
room
:
{
roomId
:
ROOM_ID
}};
timelineSet
.
room
.
getUnfilteredTimelineSet
=
function
()
{
return
timelineSet
;
};
const
timeline
=
new
EventTimeline
(
timelineSet
);
const
timeline
=
new
EventTimeline
(
timelineSet
);
timelineSet
.
timeline
=
timeline
;
// add the events after the baseIndex first
// add the events after the baseIndex first
addEventsToTimeline
(
timeline
,
numEvents
-
baseIndex
,
false
);
addEventsToTimeline
(
timeline
,
numEvents
-
baseIndex
,
false
);
...
@@ -153,7 +165,8 @@ describe("TimelineWindow", function() {
...
@@ -153,7 +165,8 @@ describe("TimelineWindow", function() {
let
timelineSet
;
let
timelineSet
;
let
client
;
let
client
;
function
createWindow
(
timeline
,
opts
)
{
function
createWindow
(
timeline
,
opts
)
{
timelineSet
=
{};
timelineSet
=
createTimelineSet
();
timelineSet
.
timeline
=
timeline
;
client
=
{};
client
=
{};
client
.
getEventTimeline
=
function
(
timelineSet0
,
eventId0
)
{
client
.
getEventTimeline
=
function
(
timelineSet0
,
eventId0
)
{
expect
(
timelineSet0
).
toBe
(
timelineSet
);
expect
(
timelineSet0
).
toBe
(
timelineSet
);
...
@@ -186,7 +199,7 @@ describe("TimelineWindow", function() {
...
@@ -186,7 +199,7 @@ describe("TimelineWindow", function() {
const
timeline
=
createTimeline
();
const
timeline
=
createTimeline
();
const
eventId
=
timeline
.
getEvents
()[
1
].
getId
();
const
eventId
=
timeline
.
getEvents
()[
1
].
getId
();
const
timelineSet
=
{}
;
const
timelineSet
=
createTimelineSet
()
;
const
client
=
{};
const
client
=
{};
client
.
getEventTimeline
=
function
(
timelineSet0
,
eventId0
)
{
client
.
getEventTimeline
=
function
(
timelineSet0
,
eventId0
)
{
expect
(
timelineSet0
).
toBe
(
timelineSet
);
expect
(
timelineSet0
).
toBe
(
timelineSet
);
...
@@ -209,7 +222,7 @@ describe("TimelineWindow", function() {
...
@@ -209,7 +222,7 @@ describe("TimelineWindow", function() {
const
eventId
=
timeline
.
getEvents
()[
1
].
getId
();
const
eventId
=
timeline
.
getEvents
()[
1
].
getId
();
const
timelineSet
=
{}
;
const
timelineSet
=
createTimelineSet
()
;
const
client
=
{};
const
client
=
{};
const
timelineWindow
=
new
TimelineWindow
(
client
,
timelineSet
);
const
timelineWindow
=
new
TimelineWindow
(
client
,
timelineSet
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment