Skip to content

Instantly share code, notes, and snippets.

@pwfisher
Forked from rwjblue/jsbin.oxasil.css
Last active September 30, 2015 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwfisher/36e85f8098f1001912a8 to your computer and use it in GitHub Desktop.
Save pwfisher/36e85f8098f1001912a8 to your computer and use it in GitHub Desktop.
JSBin for Ember.js test setup with QUnit (http://jsbin.com/soxawi/edit)
#ember-testing-container {
position: absolute;
background: white;
bottom: 0;
right: 0;
width: 640px;
height: 384px;
overflow: auto;
z-index: 9999;
border: 1px solid #ccc;
}
#ember-testing {
zoom: 50%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-latest.js"></script>
<script src="http://builds.emberjs.com/release/ember.js"></script>
<script src="http://builds.emberjs.com/release/ember-data.js"></script>
<script src="http://code.jquery.com/qunit/qunit-git.js"></script>
<script src="http://cdn.rawgit.com/rwjblue/ember-qunit-builds/v0.4.10/ember-qunit.js"></script>
<script src="http://builds.emberjs.com/latest/ember-template-compiler.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.12.0.css" media="all">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="ember-testing-container">
<div id="ember-testing"></div>
</div>
<script type="text/x-handlebars">
{{outlet}}
</script>
<script type="text/x-handlebars" id="index">
<h1>People</h1>
<ul>
{{#each model}}
<li class="people">Hello, <b>{{fullName}}</b>!</li>
{{/each}}
</ul>
</script>
</body>
</html>
App = Ember.Application.create();
Ember.testing = true;
App.rootElement = '#ember-testing';
App.setupForTesting();
App.injectTestHelpers();
setResolver(Ember.DefaultResolver.create({ namespace: App }));
App.MessageList = DS.Model.extend({
messages: function () { return []; }.property(),
addMessage: function (x) {
this.get('messages').push(x);
}
});
moduleForModel('message-list');
test('it should add a message string', function (assert) {
this.subject().addMessage('test message');
assert.equal(true, true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment