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
var nodeunit = require('nodeunit'); | |
exports['API'] = nodeunit.testCase({ | |
'The show() API method returns a specific thread by title and its replies by threadid': function(test) { | |
test.expect(4); | |
// our mock data | |
var posts = [{post: 'test'}, {post: 'test2'}]; | |
var thread = {_id: '1234', title: 'my thread'}; |
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
$(function() { | |
window.ThreadController = Backbone.Controller.extend({ | |
initialize: function() { | |
this.threadListModel = new ThreadListModel; | |
this.threadListView = new ThreadListView; | |
Backbone.history.start(); | |
}, | |
routes: { | |
"/" : "listThreads" |
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
this.post('#/thread', function(context) { | |
$.post('thread', this.params); | |
this.redirect('#/thread/' + this.params.title); | |
}); |
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
<pre> | |
<div class="thread"> | |
<div class="thread-title"> | |
<a href="#/thread/<%= thread.title %>"><%= thread.title %></a> | |
</div> | |
<time><%= thread.postdate %></time> | |
<div class="thread-author"><%= thread.author %></div> | |
</div> | |
</pre> |
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
this.get('#/', function(context) { | |
this.load('thread') | |
.then( function(threads) { | |
$.each(threads, function(i, thread) { | |
context.render('templates/thread.template', {thread : thread}).appendTo(context.$element()); | |
}); | |
}); | |
}); |
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
(function($) { | |
var app = $.sammy('#main', function() { | |
this.use('Template'); | |
this.get('#/', function(context) { | |
this.load('thread') | |
.then( function(threads) { | |
$.each(threads, function(i, thread) { | |
context.render('templates/thread.template', {thread : thread}) | |
.appendTo(context.$element()); | |
}); |
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
(function($) { | |
var app = $.sammy('#main', function() { | |
this.get('#/', function(context) { | |
alert('index!'); | |
}); | |
}); | |
$(function() { | |
app.run('#/'); | |
}); |
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
public static void clickElement(WebDriver driver, By condition) { | |
WebElement sbutton = driver.findElement(condition); | |
sbutton.sendKeys("\n"); | |
try { | |
sbutton = driver.findElement(condition); | |
sbutton.click(); | |
} catch (NoSuchElementException e) {} | |
} |
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
if (System.getProperty("os.name").startsWith("Windows")) | |
suppliers.add(INTERNET_EXPLORER_SUPPLIER) | |
} |
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 | |
public void runSomeIntegrationTest() { | |
for (Supplier<WebDriver> supplier : WebDriverSupplier.getWebDrivers()) { | |
WebDriver driver = supplier.get(); | |
Selenium selenium = new WebDriverBackedSelenium(driver, SharedConfiguration.BASE_URL); | |
selenium.open("page.html"); | |
SeleniumUtils.waitForElementPresent(selenium, "xpath=//tr[@id='task-TASK_001']"); | |
SeleniumUtils.clickElement(driver, By.linkText("1001")); | |
SeleniumUtils.waitForElementPresent(selenium, "xpath=//tr[@id='wo-1001']"); | |
assertEquals("CANCELLED", selenium.getText("xpath=//tr[@id='wo-1001']/td[3]")); |