Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
e7d563b3
Commit
e7d563b3
authored
Aug 08, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let tests pass again
parent
729bea2a
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
134 additions
and
134 deletions
+134
-134
main.js
main.js
+1
-1
spec/chatbox.js
spec/chatbox.js
+54
-54
spec/chatroom.js
spec/chatroom.js
+11
-11
spec/controlbox.js
spec/controlbox.js
+32
-32
spec/converse.js
spec/converse.js
+6
-6
spec/eventemitter.js
spec/eventemitter.js
+6
-6
spec/minchats.js
spec/minchats.js
+16
-16
spec/otr.js
spec/otr.js
+6
-6
tests/main.js
tests/main.js
+1
-1
tests/utils.js
tests/utils.js
+1
-1
No files found.
main.js
View file @
e7d563b3
...
...
@@ -75,7 +75,7 @@ config = {
'
bigint
'
:
{
deps
:
[
'
crypto
'
]
},
'
jquery.browser
'
:
{
deps
:
[
'
jquery
'
]
},
'
jquery.easing
'
:
{
deps
:
[
'
jquery
'
]
},
'
utils
'
:{
deps
:
[
'
jquery
'
]
},
'
utils
'
:
{
deps
:
[
'
jquery
'
]
},
'
strophe
'
:
{
deps
:
[
'
jquery
'
]
},
'
strophe.disco
'
:
{
deps
:
[
'
strophe
'
]
},
'
strophe.muc
'
:
{
deps
:
[
'
strophe
'
,
'
jquery
'
]
},
...
...
spec/chatbox.js
View file @
e7d563b3
This diff is collapsed.
Click to expand it.
spec/chatroom.js
View file @
e7d563b3
(
function
(
root
,
factory
)
{
define
([
"
mock
"
,
"
utils
"
],
function
(
mock
,
utils
)
{
return
factory
(
mock
,
utils
);
"
test_
utils
"
],
function
(
mock
,
test_
utils
)
{
return
factory
(
mock
,
test_
utils
);
}
);
}
(
this
,
function
(
mock
,
utils
)
{
return
describe
(
"
ChatRooms
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
}
(
this
,
function
(
mock
,
test_
utils
)
{
return
describe
(
"
ChatRooms
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
describe
(
"
A Chat Room
"
,
$
.
proxy
(
function
()
{
beforeEach
(
function
()
{
runs
(
function
()
{
utils
.
closeAllChatBoxes
();
test_
utils
.
closeAllChatBoxes
();
});
waits
(
250
);
runs
(
function
()
{
utils
.
openControlBox
();
test_
utils
.
openControlBox
();
});
waits
(
250
);
runs
(
function
()
{
utils
.
openRoomsPanel
();
test_
utils
.
openRoomsPanel
();
});
waits
(
501
);
runs
(
function
()
{
...
...
@@ -35,7 +35,7 @@
});
waits
(
250
);
runs
(
function
()
{
utils
.
closeControlBox
();
test_
utils
.
closeControlBox
();
});
waits
(
250
);
runs
(
function
()
{});
...
...
@@ -116,7 +116,7 @@
// We instantiate a new ChatBoxes collection, which by default
// will be empty.
spyOn
(
this
.
chatboxviews
,
'
trimChats
'
);
utils
.
openControlBox
();
test_
utils
.
openControlBox
();
var
newchatboxes
=
new
this
.
ChatBoxes
();
expect
(
newchatboxes
.
length
).
toEqual
(
0
);
// The chatboxes will then be fetched from browserStorage inside the
...
...
@@ -350,5 +350,5 @@
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
"
This room has reached it's maximum number of occupants
"
);
},
converse
));
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
}));
spec/controlbox.js
View file @
e7d563b3
(
function
(
root
,
factory
)
{
define
([
"
mock
"
,
"
utils
"
],
function
(
mock
,
utils
)
{
return
factory
(
mock
,
utils
);
"
test_
utils
"
],
function
(
mock
,
test_
utils
)
{
return
factory
(
mock
,
test_
utils
);
}
);
}
(
this
,
function
(
mock
,
utils
)
{
}
(
this
,
function
(
mock
,
test_
utils
)
{
var
checkHeaderToggling
=
function
(
$header
)
{
var
$toggle
=
$header
.
find
(
'
a.group-toggle
'
);
...
...
@@ -24,16 +24,16 @@
expect
(
$header
.
nextUntil
(
'
dt
'
,
'
dd
'
).
length
===
$header
.
nextUntil
(
'
dt
'
,
'
dd:visible
'
).
length
).
toBeTruthy
();
};
describe
(
"
The Control Box
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
describe
(
"
The Control Box
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
beforeEach
(
function
()
{
runs
(
function
()
{
utils
.
openControlBox
();
test_
utils
.
openControlBox
();
});
});
it
(
"
can be opened by clicking a DOM element with class 'toggle-controlbox'
"
,
$
.
proxy
(
function
()
{
runs
(
function
()
{
utils
.
closeControlBox
();
test_
utils
.
closeControlBox
();
});
waits
(
50
);
runs
(
function
()
{
...
...
@@ -59,7 +59,7 @@
describe
(
"
The Status Widget
"
,
$
.
proxy
(
function
()
{
beforeEach
(
function
()
{
utils
.
openControlBox
();
test_
utils
.
openControlBox
();
});
it
(
"
shows the user's chat status, which is online by default
"
,
$
.
proxy
(
function
()
{
...
...
@@ -120,9 +120,9 @@
});
},
converse
));
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
describe
(
"
The Contacts Roster
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
describe
(
"
The Contacts Roster
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
describe
(
"
A Roster Group
"
,
$
.
proxy
(
function
()
{
...
...
@@ -135,7 +135,7 @@
});
function
_clearContacts
()
{
utils
.
clearBrowserStorage
();
test_
utils
.
clearBrowserStorage
();
converse
.
rosterview
.
model
.
reset
();
}
...
...
@@ -146,8 +146,8 @@
spyOn
(
this
.
rosterview
,
'
update
'
).
andCallThrough
();
converse
.
rosterview
.
render
();
utils
.
createContacts
(
'
pending
'
);
utils
.
createContacts
(
'
requesting
'
);
test_
utils
.
createContacts
(
'
pending
'
);
test_
utils
.
createContacts
(
'
requesting
'
);
var
groups
=
{
'
colleagues
'
:
3
,
'
friends & acquaintences
'
:
3
,
...
...
@@ -243,14 +243,14 @@
describe
(
"
Pending Contacts
"
,
$
.
proxy
(
function
()
{
function
_clearContacts
()
{
utils
.
clearBrowserStorage
();
test_
utils
.
clearBrowserStorage
();
converse
.
rosterview
.
model
.
reset
();
}
function
_addContacts
()
{
_clearContacts
();
// Must be initialized, so that render is called and documentFragment set up.
utils
.
createContacts
(
'
pending
'
).
openControlBox
().
openContactsPanel
();
test_
utils
.
createContacts
(
'
pending
'
).
openControlBox
().
openContactsPanel
();
}
it
(
"
can be collapsed under their own header
"
,
$
.
proxy
(
function
()
{
...
...
@@ -350,13 +350,13 @@
describe
(
"
Existing Contacts
"
,
$
.
proxy
(
function
()
{
function
_clearContacts
()
{
utils
.
clearBrowserStorage
();
test_
utils
.
clearBrowserStorage
();
converse
.
rosterview
.
model
.
reset
();
}
var
_addContacts
=
function
()
{
_clearContacts
();
utils
.
createContacts
().
openControlBox
().
openContactsPanel
();
test_
utils
.
createContacts
().
openControlBox
().
openContactsPanel
();
};
it
(
"
can be collapsed under their own header
"
,
$
.
proxy
(
function
()
{
...
...
@@ -561,13 +561,13 @@
describe
(
"
Requesting Contacts
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
runs
(
function
()
{
utils
.
clearBrowserStorage
();
test_
utils
.
clearBrowserStorage
();
converse
.
rosterview
.
model
.
reset
();
utils
.
createContacts
(
'
requesting
'
).
openControlBox
();
test_
utils
.
createContacts
(
'
requesting
'
).
openControlBox
();
});
waits
(
50
);
runs
(
function
()
{
utils
.
openContactsPanel
();
test_
utils
.
openContactsPanel
();
});
},
converse
));
...
...
@@ -646,7 +646,7 @@
spyOn
(
converse
,
'
emit
'
);
spyOn
(
this
.
connection
.
roster
,
'
unauthorize
'
);
spyOn
(
window
,
'
confirm
'
).
andReturn
(
true
);
utils
.
createContacts
(
'
requesting
'
).
openControlBox
();
test_
utils
.
createContacts
(
'
requesting
'
).
openControlBox
();
var
name
=
mock
.
req_names
.
sort
()[
1
];
var
jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
converse
.
rosterview
.
$el
.
find
(
"
.req-contact-name:contains('
"
+
name
+
"
')
"
)
...
...
@@ -661,10 +661,10 @@
describe
(
"
All Contacts
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
utils
.
clearBrowserStorage
();
test_
utils
.
clearBrowserStorage
();
converse
.
rosterview
.
model
.
reset
();
utils
.
createContacts
(
'
all
'
).
openControlBox
();
utils
.
openContactsPanel
();
test_
utils
.
createContacts
(
'
all
'
).
openControlBox
();
test_
utils
.
openContactsPanel
();
},
converse
));
it
(
"
are saved to, and can be retrieved from, browserStorage
"
,
$
.
proxy
(
function
()
{
...
...
@@ -700,9 +700,9 @@
}
},
converse
));
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
describe
(
"
The 'Add Contact' widget
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
describe
(
"
The 'Add Contact' widget
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
it
(
"
opens up an add form when you click on it
"
,
$
.
proxy
(
function
()
{
var
panel
=
this
.
chatboxviews
.
get
(
'
controlbox
'
).
contactspanel
;
spyOn
(
panel
,
'
toggleContactForm
'
).
andCallThrough
();
...
...
@@ -713,16 +713,16 @@
panel
.
$el
.
find
(
'
a.toggle-xmpp-contact-form
'
).
click
();
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
describe
(
"
The Controlbox Tabs
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
runs
(
function
()
{
utils
.
closeAllChatBoxes
();
test_
utils
.
closeAllChatBoxes
();
});
waits
(
50
);
runs
(
function
()
{
utils
.
openControlBox
();
test_
utils
.
openControlBox
();
});
},
converse
));
...
...
@@ -739,11 +739,11 @@
describe
(
"
chatrooms panel
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
runs
(
function
()
{
utils
.
closeAllChatBoxes
();
test_
utils
.
closeAllChatBoxes
();
});
waits
(
50
);
runs
(
function
()
{
utils
.
openControlBox
();
test_
utils
.
openControlBox
();
});
},
converse
));
...
...
@@ -792,5 +792,5 @@
},
converse
));
},
converse
));
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
}));
spec/converse.js
View file @
e7d563b3
(
function
(
root
,
factory
)
{
define
([
"
mock
"
,
"
utils
"
],
function
(
mock
,
utils
)
{
return
factory
(
mock
,
utils
);
"
test_
utils
"
],
function
(
mock
,
test_
utils
)
{
return
factory
(
mock
,
test_
utils
);
}
);
}
(
this
,
function
(
mock
,
utils
)
{
return
describe
(
"
Converse
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
}
(
this
,
function
(
mock
,
test_
utils
)
{
return
describe
(
"
Converse
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
beforeEach
(
$
.
proxy
(
function
()
{
window
.
localStorage
.
clear
();
...
...
@@ -43,5 +43,5 @@
// Restore the connection
converse
.
connection
=
old_connection
;
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
}));
spec/eventemitter.js
View file @
e7d563b3
(
function
(
root
,
factory
)
{
define
([
"
mock
"
,
"
utils
"
],
function
(
mock
,
utils
)
{
return
factory
(
mock
,
utils
);
"
test_
utils
"
],
function
(
mock
,
test_
utils
)
{
return
factory
(
mock
,
test_
utils
);
}
);
}
(
this
,
function
(
mock
,
utils
)
{
return
describe
(
"
The Converse Event Emitter
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
}
(
this
,
function
(
mock
,
test_
utils
)
{
return
describe
(
"
The Converse Event Emitter
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
window
.
localStorage
.
clear
();
window
.
sessionStorage
.
clear
();
...
...
@@ -64,5 +64,5 @@
expect
(
this
.
anotherCallback
.
callCount
,
3
);
expect
(
this
.
neverCalled
).
not
.
toHaveBeenCalled
();
});
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
}));
spec/minchats.js
View file @
e7d563b3
(
function
(
root
,
factory
)
{
define
([
"
mock
"
,
"
utils
"
],
function
(
mock
,
utils
)
{
return
factory
(
mock
,
utils
);
"
test_
utils
"
],
function
(
mock
,
test_
utils
)
{
return
factory
(
mock
,
test_
utils
);
}
);
}
(
this
,
function
(
mock
,
utils
)
{
return
describe
(
"
The Minimized Chats Widget
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
}
(
this
,
function
(
mock
,
test_
utils
)
{
return
describe
(
"
The Minimized Chats Widget
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
beforeEach
(
function
()
{
runs
(
function
()
{
utils
.
closeAllChatBoxes
();
utils
.
removeControlBox
();
test_
utils
.
closeAllChatBoxes
();
test_
utils
.
removeControlBox
();
converse
.
roster
.
browserStorage
.
_clear
();
utils
.
initConverse
();
utils
.
createContacts
();
utils
.
openControlBox
();
utils
.
openContactsPanel
();
test_
utils
.
initConverse
();
test_
utils
.
createContacts
();
test_
utils
.
openControlBox
();
test_
utils
.
openContactsPanel
();
converse
.
minimized_chats
.
toggleview
.
model
.
browserStorage
.
_clear
();
converse
.
minimized_chats
.
initToggle
();
});
...
...
@@ -26,7 +26,7 @@
it
(
"
shows chats that have been minimized
"
,
$
.
proxy
(
function
()
{
var
contact_jid
,
chatview
;
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
test_
utils
.
openChatBoxFor
(
contact_jid
);
chatview
=
converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
expect
(
this
.
minimized_chats
.
$el
.
is
(
'
:visible
'
)).
toBeFalsy
();
...
...
@@ -37,7 +37,7 @@
expect
(
this
.
minimized_chats
.
keys
()[
0
]).
toBe
(
contact_jid
);
contact_jid
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
test_
utils
.
openChatBoxFor
(
contact_jid
);
chatview
=
converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
chatview
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
click
();
...
...
@@ -49,7 +49,7 @@
it
(
"
can be toggled to hide or show minimized chats
"
,
$
.
proxy
(
function
()
{
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
test_
utils
.
openChatBoxFor
(
contact_jid
);
var
chatview
=
converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
this
.
minimized_chats
.
$el
.
is
(
'
:visible
'
)).
toBeFalsy
();
chatview
.
model
.
set
({
'
minimized
'
:
true
});
...
...
@@ -70,7 +70,7 @@
expect
(
this
.
minimized_chats
.
toggleview
.
$
(
'
.unread-message-count
'
).
is
(
'
:visible
'
)).
toBeFalsy
();
for
(
i
=
0
;
i
<
3
;
i
++
)
{
contact_jid
=
mock
.
cur_names
[
i
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
test_
utils
.
openChatBoxFor
(
contact_jid
);
chatview
=
converse
.
chatboxviews
.
get
(
contact_jid
);
chatview
.
model
.
set
({
'
minimized
'
:
true
});
msg
=
$msg
({
...
...
@@ -86,5 +86,5 @@
}
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
}));
spec/otr.js
View file @
e7d563b3
(
function
(
root
,
factory
)
{
define
([
"
mock
"
,
"
utils
"
],
function
(
mock
,
utils
)
{
return
factory
(
mock
,
utils
);
"
test_
utils
"
],
function
(
mock
,
test_
utils
)
{
return
factory
(
mock
,
test_
utils
);
}
);
}
(
this
,
function
(
mock
,
utils
)
{
return
describe
(
"
The OTR module
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
}
(
this
,
function
(
mock
,
test_
utils
)
{
return
describe
(
"
The OTR module
"
,
$
.
proxy
(
function
(
mock
,
test_
utils
)
{
beforeEach
(
$
.
proxy
(
function
()
{
window
.
localStorage
.
clear
();
...
...
@@ -36,5 +36,5 @@
// Clean up
this
.
prebind
=
false
;
},
converse
));
},
converse
,
mock
,
utils
));
},
converse
,
mock
,
test_
utils
));
}));
tests/main.js
View file @
e7d563b3
// Extra test dependencies
config
.
paths
.
mock
=
"
tests/mock
"
;
config
.
paths
.
utils
=
"
tests/utils
"
;
config
.
paths
.
test_
utils
=
"
tests/utils
"
;
config
.
paths
.
jasmine
=
"
components/jasmine/lib/jasmine-core/jasmine
"
;
config
.
paths
[
"
jasmine-html
"
]
=
"
components/jasmine/lib/jasmine-core/jasmine-html
"
;
config
.
paths
[
"
console-runner
"
]
=
"
node_modules/phantom-jasmine/lib/console-runner
"
;
...
...
tests/utils.js
View file @
e7d563b3
(
function
(
root
,
factory
)
{
define
(
"
utils
"
,
[
define
(
"
test_
utils
"
,
[
'
jquery
'
,
'
mock
'
],
...
...
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