mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Lightly massage some of the generated JavaScript
This commit is contained in:
parent
31ad9566e6
commit
1867a3f121
19 changed files with 986 additions and 989 deletions
|
@ -1,10 +1,7 @@
|
|||
// Generated by CoffeeScript 2.4.1
|
||||
/*
|
||||
jasmine tests for Snowflake UI
|
||||
*/
|
||||
var document;
|
||||
|
||||
document = {
|
||||
var document = {
|
||||
getElementById: function(id) {
|
||||
return {};
|
||||
},
|
||||
|
@ -14,6 +11,7 @@ document = {
|
|||
};
|
||||
|
||||
describe('UI', function() {
|
||||
|
||||
it('activates debug mode when badge does not exist', function() {
|
||||
var u;
|
||||
spyOn(document, 'getElementById').and.callFake(function(id) {
|
||||
|
@ -25,8 +23,9 @@ describe('UI', function() {
|
|||
u = new DebugUI();
|
||||
expect(document.getElementById.calls.count()).toEqual(2);
|
||||
expect(u.$status).not.toBeNull();
|
||||
return expect(u.$msglog).not.toBeNull();
|
||||
expect(u.$msglog).not.toBeNull();
|
||||
});
|
||||
|
||||
it('is not debug mode when badge exists', function() {
|
||||
var u;
|
||||
spyOn(document, 'getElementById').and.callFake(function(id) {
|
||||
|
@ -38,8 +37,9 @@ describe('UI', function() {
|
|||
u = new BadgeUI();
|
||||
expect(document.getElementById).toHaveBeenCalled();
|
||||
expect(document.getElementById.calls.count()).toEqual(1);
|
||||
return expect(u.$badge).not.toBeNull();
|
||||
expect(u.$badge).not.toBeNull();
|
||||
});
|
||||
|
||||
it('sets status message when in debug mode', function() {
|
||||
var u;
|
||||
u = new DebugUI();
|
||||
|
@ -50,16 +50,18 @@ describe('UI', function() {
|
|||
}
|
||||
};
|
||||
u.setStatus('test');
|
||||
return expect(u.$status.innerHTML).toEqual('Status: test');
|
||||
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('');
|
||||
expect(u.$msglog.className).toEqual('');
|
||||
});
|
||||
|
||||
it('sets badge css correctly for non-debug mode', function() {
|
||||
var u;
|
||||
u = new BadgeUI();
|
||||
|
@ -67,9 +69,10 @@ describe('UI', function() {
|
|||
u.setActive(true);
|
||||
expect(u.$badge.className).toEqual('active');
|
||||
u.setActive(false);
|
||||
return expect(u.$badge.className).toEqual('');
|
||||
expect(u.$badge.className).toEqual('');
|
||||
});
|
||||
return it('logs to the textarea correctly when debug mode', function() {
|
||||
|
||||
it('logs to the textarea correctly when debug mode', function() {
|
||||
var u;
|
||||
u = new DebugUI();
|
||||
u.$msglog = {
|
||||
|
@ -79,6 +82,7 @@ describe('UI', function() {
|
|||
};
|
||||
u.log('test');
|
||||
expect(u.$msglog.value).toEqual('test\n');
|
||||
return expect(u.$msglog.scrollTop).toEqual(1337);
|
||||
expect(u.$msglog.scrollTop).toEqual(1337);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue