-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put real functions in a class (and remove dummy stuff)
- Loading branch information
Showing
2 changed files
with
6 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
window.Encryptor = class Encryptor | ||
@addOne: (number) -> | ||
number + 1 | ||
@encrypt: => | ||
plainText = $("#plain-text").val() | ||
$.get "/encrypt", {text: plainText}, @update | ||
|
||
encrypt = -> | ||
plainText = $("#plain-text").val() | ||
$.get "/encrypt", {text: plainText}, update | ||
|
||
update = (data) -> | ||
$("#encrypted-text").val data.text | ||
@update: (data) => | ||
$("#encrypted-text").val data.text | ||
|
||
$ -> | ||
$("#plain-text").keyup encrypt | ||
$("#plain-text").keyup window.Encryptor.encrypt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +0,0 @@ | ||
describe "2 + 2", -> | ||
it "is 4", -> | ||
expect(2 + 2).toEqual 4 | ||
|
||
describe "addOne", -> | ||
it "adds one to a number", -> | ||
expect(window.Encryptor.addOne(42)).toEqual 43 | ||