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
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
<script> | |
function currentPageFormatter(event) { | |
var formattedStr; | |
if (event.indexh === 0) { | |
return ""; | |
} | |
formattedStr = event.indexh; |
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
test("should update the dom", () => { | |
$("div").text("bob"); | |
expect($("div").text()).toBe("bob"); | |
}); |
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
describe("deletePost", () => { | |
test("calls the REST API method to delete the post, but only if the user is logged in", () => { | |
const mockUser = new User({ username: "bob" }); | |
mockUser.ajax = spy(); | |
mockUser.login(); | |
mockUser.deletePost(); | |
expect(mockUser.ajax).to.haveCallCount(1); |
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
describe("deletePost", () => { | |
let mockUser; | |
beforeEach(() => { | |
mockUser = new User({ username: "bob" }); | |
mockUser.ajax = spy(); | |
}); | |
test("calls the REST API method to delete the post", () => { |
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
describe("deletePost", () => { | |
test("calls the REST API method to delete the post", () => { | |
// Setup | |
const mockUser = new User({ username: "bob" }); | |
mockUser.ajax = spy(); | |
mockUser.login(); | |
// Action | |
mockUser.deletePost(); |
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
describe("searchPosts", () => { | |
test("filters the results according to the input search", () => { | |
const loadPostsBackup = User.prototype.loadPosts; | |
User.prototype.loadPosts = () => [{id: 1, title: "bob"}, {id: 2, title: "alice"}]; | |
const mockUser = new User({ username: "bob" }); | |
expect(mockUser.searchPosts("bob")).toEqual([{id: 1, title: "bob"}]); |
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
describe("searchPosts", () => { | |
test("filters the results according to the input search", () => { | |
const mockUser = new User({ username: "bob" }); | |
mockUser.loadPosts = () => [{id: 1, title: "bob"}, {id: 2, title: "alice"}]; | |
expect(mockUser.searchPosts("bob")).toEqual([{id: 1, title: "bob"}]); | |
}); | |
}); |
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
<METHOD_NAME> | |
<TEST> | |
<TEST> | |
... | |
<METHOD_NAME> | |
<TEST> | |
<TEST> | |
... |
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
class Dialog extends Component { | |
deleteUser() { | |
// `deleteUser` implementation | |
} | |
render() { | |
// `render` implementation | |
} | |
} |
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
describe("deleteUser", () => { | |
test("makes a request to the delete user endpoint", () => { | |
// Test code | |
}); | |
}); | |
describe("render", () => { | |
test("renders the user name if the user is logged in", () => { | |
// Test code | |
}); |
OlderNewer