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
4bc2b722
Commit
4bc2b722
authored
Aug 24, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tests initialization (broken during recent refactor)
parent
bde89135
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
51 deletions
+54
-51
converse.js
converse.js
+25
-21
tests_main.js
tests_main.js
+29
-30
No files found.
converse.js
View file @
4bc2b722
...
...
@@ -41,7 +41,7 @@
}
}(
this
,
function
(
$
,
_
,
console
)
{
var
converse
=
{};
converse
.
initialize
=
function
(
settings
)
{
converse
.
initialize
=
function
(
settings
,
callback
)
{
// Default values
var
converse
=
this
;
this
.
animate
=
true
;
...
...
@@ -54,6 +54,8 @@
this
.
prebind
=
false
;
this
.
show_controlbox_by_default
=
false
;
this
.
xhr_user_search
=
false
;
this
.
testing
=
false
;
// Exposes sensitive data for testing. Never set to true in production systems!
this
.
callback
=
callback
||
function
()
{};
// Allow only the whitelisted settings attributes to be overwritten,
// nothing else.
...
...
@@ -68,7 +70,9 @@
'
i18n
'
,
'
prebind
'
,
'
show_controlbox_by_default
'
,
'
xhr_user_search
'
'
xhr_user_search
'
,
'
connection
'
,
'
testing
'
];
_
.
extend
(
this
,
_
.
pick
(
settings
,
whitelist
));
...
...
@@ -216,10 +220,10 @@
.
t
(
'
1
'
);
converse
.
connection
.
sendIQ
(
iq
,
callback
,
function
()
{
converse
.
log
(
'
Error while retrieving collections
'
);
});
callback
,
function
()
{
converse
.
log
(
'
Error while retrieving collections
'
);
});
};
this
.
collections
.
getLastMessages
=
function
(
jid
,
callback
)
{
...
...
@@ -2635,7 +2639,7 @@
this
.
rosterview
=
new
this
.
RosterView
({
'
model
'
:
this
.
roster
});
}
this
.
onConnected
=
function
(
callback
)
{
this
.
onConnected
=
function
()
{
if
(
this
.
debug
)
{
this
.
connection
.
xmlInput
=
function
(
body
)
{
console
.
log
(
body
);
};
this
.
connection
.
xmlOutput
=
function
(
body
)
{
console
.
log
(
body
);
};
...
...
@@ -2674,8 +2678,10 @@
this
.
windowState
=
e
.
type
;
},
this
));
this
.
giveFeedback
(
__
(
'
Online Contacts
'
));
if
(
callback
)
{
callback
(
this
);
if
(
this
.
testing
)
{
this
.
callback
(
this
);
}
else
{
this
.
callback
();
}
},
this
));
};
...
...
@@ -2689,23 +2695,21 @@
e
.
preventDefault
();
this
.
toggleControlBox
();
},
this
)
);
if
(
this
.
prebind
)
{
if
(
!
this
.
connection
)
{
if
((
!
this
.
jid
)
||
(
!
this
.
sid
)
||
(
!
this
.
rid
)
||
(
!
this
.
bosh_service_url
))
{
this
.
log
(
'
If you set prebind=true, you MUST supply JID, RID and SID values
'
);
return
;
}
this
.
connection
=
new
Strophe
.
Connection
(
this
.
bosh_service_url
);
this
.
connection
.
attach
(
this
.
jid
,
this
.
sid
,
this
.
rid
,
this
.
onConnect
);
}
else
{
this
.
onConnected
();
if
((
this
.
prebind
)
&&
(
!
this
.
connection
))
{
if
((
!
this
.
jid
)
||
(
!
this
.
sid
)
||
(
!
this
.
rid
)
||
(
!
this
.
bosh_service_url
))
{
this
.
log
(
'
If you set prebind=true, you MUST supply JID, RID and SID values
'
);
return
;
}
this
.
connection
=
new
Strophe
.
Connection
(
this
.
bosh_service_url
);
this
.
connection
.
attach
(
this
.
jid
,
this
.
sid
,
this
.
rid
,
this
.
onConnect
);
}
else
if
(
this
.
connection
)
{
this
.
onConnected
();
}
if
(
this
.
show_controlbox_by_default
)
{
this
.
showControlBox
();
}
};
return
{
'
initialize
'
:
function
(
settings
)
{
converse
.
initialize
(
settings
);
'
initialize
'
:
function
(
settings
,
callback
)
{
converse
.
initialize
(
settings
,
callback
);
}
};
}));
tests_main.js
View file @
4bc2b722
...
...
@@ -68,36 +68,35 @@ require([
prebind
:
false
,
xhr_user_search
:
false
,
auto_subscribe
:
false
,
animate
:
false
animate
:
false
,
connection
:
mock_connection
,
testing
:
true
},
function
(
converse
)
{
window
.
converse
=
converse
;
require
([
"
jasmine-console-reporter
"
,
"
jasmine-junit-reporter
"
,
"
spec/MainSpec
"
,
"
spec/ChatRoomSpec
"
],
function
()
{
// Jasmine stuff
var
jasmineEnv
=
jasmine
.
getEnv
();
if
(
/PhantomJS/
.
test
(
navigator
.
userAgent
))
{
jasmineEnv
.
addReporter
(
new
jasmine
.
TrivialReporter
());
jasmineEnv
.
addReporter
(
new
jasmine
.
JUnitXmlReporter
(
'
./test-reports/
'
));
jasmineEnv
.
addReporter
(
new
jasmine
.
ConsoleReporter
());
jasmineEnv
.
updateInterval
=
0
;
}
else
{
var
htmlReporter
=
new
jasmine
.
HtmlReporter
();
jasmineEnv
.
addReporter
(
htmlReporter
);
jasmineEnv
.
addReporter
(
new
jasmine
.
ConsoleReporter
());
jasmineEnv
.
specFilter
=
function
(
spec
)
{
return
htmlReporter
.
specFilter
(
spec
);
};
jasmineEnv
.
updateInterval
=
200
;
}
jasmineEnv
.
execute
();
});
});
converse
.
onConnected
(
function
(
converse
)
{
window
.
converse
=
converse
;
require
([
"
jasmine-console-reporter
"
,
"
jasmine-junit-reporter
"
,
"
spec/MainSpec
"
,
"
spec/ChatRoomSpec
"
],
function
()
{
// Jasmine stuff
var
jasmineEnv
=
jasmine
.
getEnv
();
if
(
/PhantomJS/
.
test
(
navigator
.
userAgent
))
{
jasmineEnv
.
addReporter
(
new
jasmine
.
TrivialReporter
());
jasmineEnv
.
addReporter
(
new
jasmine
.
JUnitXmlReporter
(
'
./test-reports/
'
));
jasmineEnv
.
addReporter
(
new
jasmine
.
ConsoleReporter
());
jasmineEnv
.
updateInterval
=
0
;
}
else
{
var
htmlReporter
=
new
jasmine
.
HtmlReporter
();
jasmineEnv
.
addReporter
(
htmlReporter
);
jasmineEnv
.
addReporter
(
new
jasmine
.
ConsoleReporter
());
jasmineEnv
.
specFilter
=
function
(
spec
)
{
return
htmlReporter
.
specFilter
(
spec
);
};
jasmineEnv
.
updateInterval
=
200
;
}
jasmineEnv
.
execute
();
});
}
);
}
);
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