-
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.
- Loading branch information
1 parent
0a161a3
commit edd992a
Showing
8 changed files
with
124 additions
and
172 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,9 +1,5 @@ | ||
(function() { | ||
'use strict'; | ||
module.exports = bar; | ||
|
||
module.exports = bar; | ||
|
||
function bar() { | ||
return "world!"; | ||
} | ||
}()); | ||
function bar() { | ||
return "world!"; | ||
} |
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,10 +1,5 @@ | ||
(function() { | ||
'use strict'; | ||
module.exports = foo; | ||
|
||
module.exports = foo; | ||
|
||
function foo() { | ||
return "Hello"; | ||
} | ||
|
||
}()); | ||
function foo() { | ||
return "Hello"; | ||
} |
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,29 +1,24 @@ | ||
(function() { | ||
'use strict'; | ||
module.exports.getMessage = getMessage; | ||
module.exports.sayHello = sayHello; | ||
module.exports.sayHelloAsync = sayHelloAsync; | ||
|
||
module.exports.getMessage = getMessage; | ||
module.exports.sayHello = sayHello; | ||
module.exports.sayHelloAsync = sayHelloAsync; | ||
// If we are in a browser, define a global variable. | ||
if (window) window.MyLib = module.exports; | ||
|
||
// If we are in a browser, define a global variable. | ||
if (window) window.MyLib = module.exports; | ||
var foo = require("./foo.js"); | ||
var bar = require("./bar.js"); | ||
|
||
var foo = require("./foo.js"); | ||
var bar = require("./bar.js"); | ||
function getMessage() { | ||
return foo() + " " + bar(); | ||
} | ||
|
||
function getMessage() { | ||
return foo() + " " + bar(); | ||
} | ||
function sayHello(el) { | ||
$(el).html(getMessage()); | ||
} | ||
|
||
function sayHello(el) { | ||
$(el).html(getMessage()); | ||
} | ||
|
||
function sayHelloAsync(el, delay, callback) { | ||
setTimeout(function() { | ||
sayHello(el); | ||
callback(); | ||
}, delay); | ||
} | ||
|
||
}()); | ||
function sayHelloAsync(el, delay, callback) { | ||
setTimeout(function() { | ||
sayHello(el); | ||
callback(); | ||
}, delay); | ||
} |
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,31 +1,25 @@ | ||
(function() { | ||
'use strict'; | ||
var assert = require("assert"); | ||
require("../../src/main.js"); | ||
|
||
var assert = require("assert"); | ||
require("../../src/main.js"); | ||
describe("MyLib", function() { | ||
beforeEach(function() { | ||
$("#message").html(""); | ||
}); | ||
|
||
describe("MyLib", function() { | ||
beforeEach(function() { | ||
$("#message").html(""); | ||
}); | ||
it("returns an important message", function() { | ||
assert.equal(MyLib.getMessage(), "Hello world!"); | ||
}); | ||
|
||
it("returns an important message", function() { | ||
assert.equal(MyLib.getMessage(), "Hello world!"); | ||
}); | ||
it("displays the message in the desired element", function() { | ||
MyLib.sayHello("#message"); | ||
assert.equal($("#message").html(), MyLib.getMessage()); | ||
}) | ||
|
||
it("displays the message in the desired element", function() { | ||
MyLib.sayHello("#message"); | ||
it("asynchronously displays the message in the desired element", function(done) { | ||
MyLib.sayHelloAsync("#message", 10, function() { | ||
assert.equal($("#message").html(), MyLib.getMessage()); | ||
}) | ||
|
||
it("asynchronously displays the message in the desired element", function(done) { | ||
MyLib.sayHelloAsync("#message", 10, function() { | ||
assert.equal($("#message").html(), MyLib.getMessage()); | ||
done(); | ||
}); | ||
}) | ||
|
||
|
||
done(); | ||
}); | ||
}); | ||
|
||
}()); | ||
}); |
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,19 +1,15 @@ | ||
(function() { | ||
'use strict'; | ||
var assert = require("assert"); | ||
var foo = require("../../src/foo.js"); | ||
var bar = require("../../src/bar.js"); | ||
|
||
var assert = require("assert"); | ||
var foo = require("../../src/foo.js"); | ||
var bar = require("../../src/bar.js"); | ||
|
||
describe("foo()", function() { | ||
it("returns 'Hello'", function() { | ||
assert.equal(foo(), "Hello"); | ||
}); | ||
describe("foo()", function() { | ||
it("returns 'Hello'", function() { | ||
assert.equal(foo(), "Hello"); | ||
}); | ||
}); | ||
|
||
describe("bar()", function() { | ||
it("returns 'world!'", function() { | ||
assert.equal(bar(), "world!"); | ||
}) | ||
}) | ||
}()); | ||
describe("bar()", function() { | ||
it("returns 'world!'", function() { | ||
assert.equal(bar(), "world!"); | ||
}); | ||
}); |
Oops, something went wrong.