mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Compile coffee files and remove them
With, ./node_modules/.bin/coffee -b -c Cakefile `find . -path ./node_modules -prune -o -name '*.coffee'`
This commit is contained in:
parent
82562fb21d
commit
31ad9566e6
38 changed files with 2277 additions and 1725 deletions
84
proxy/spec/ui.spec.js
Normal file
84
proxy/spec/ui.spec.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
// Generated by CoffeeScript 2.4.1
|
||||
/*
|
||||
jasmine tests for Snowflake UI
|
||||
*/
|
||||
var document;
|
||||
|
||||
document = {
|
||||
getElementById: function(id) {
|
||||
return {};
|
||||
},
|
||||
createTextNode: function(txt) {
|
||||
return txt;
|
||||
}
|
||||
};
|
||||
|
||||
describe('UI', function() {
|
||||
it('activates debug mode when badge does not exist', function() {
|
||||
var u;
|
||||
spyOn(document, 'getElementById').and.callFake(function(id) {
|
||||
if ('badge' === id) {
|
||||
return null;
|
||||
}
|
||||
return {};
|
||||
});
|
||||
u = new DebugUI();
|
||||
expect(document.getElementById.calls.count()).toEqual(2);
|
||||
expect(u.$status).not.toBeNull();
|
||||
return expect(u.$msglog).not.toBeNull();
|
||||
});
|
||||
it('is not debug mode when badge exists', function() {
|
||||
var u;
|
||||
spyOn(document, 'getElementById').and.callFake(function(id) {
|
||||
if ('badge' === id) {
|
||||
return {};
|
||||
}
|
||||
return null;
|
||||
});
|
||||
u = new BadgeUI();
|
||||
expect(document.getElementById).toHaveBeenCalled();
|
||||
expect(document.getElementById.calls.count()).toEqual(1);
|
||||
return expect(u.$badge).not.toBeNull();
|
||||
});
|
||||
it('sets status message when in debug mode', function() {
|
||||
var u;
|
||||
u = new DebugUI();
|
||||
u.$status = {
|
||||
innerHTML: '',
|
||||
appendChild: function(txt) {
|
||||
return this.innerHTML = txt;
|
||||
}
|
||||
};
|
||||
u.setStatus('test');
|
||||
return expect(u.$status.innerHTML).toEqual('Status: test');
|
||||
});
|
||||
it('sets message log css correctly for debug mode', function() {
|
||||
var u;
|
||||
u = new DebugUI();
|
||||
u.setActive(true);
|
||||
expect(u.$msglog.className).toEqual('active');
|
||||
u.setActive(false);
|
||||
return expect(u.$msglog.className).toEqual('');
|
||||
});
|
||||
it('sets badge css correctly for non-debug mode', function() {
|
||||
var u;
|
||||
u = new BadgeUI();
|
||||
u.$badge = {};
|
||||
u.setActive(true);
|
||||
expect(u.$badge.className).toEqual('active');
|
||||
u.setActive(false);
|
||||
return expect(u.$badge.className).toEqual('');
|
||||
});
|
||||
return it('logs to the textarea correctly when debug mode', function() {
|
||||
var u;
|
||||
u = new DebugUI();
|
||||
u.$msglog = {
|
||||
value: '',
|
||||
scrollTop: 0,
|
||||
scrollHeight: 1337
|
||||
};
|
||||
u.log('test');
|
||||
expect(u.$msglog.value).toEqual('test\n');
|
||||
return expect(u.$msglog.scrollTop).toEqual(1337);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue