Skip to content

Instantly share code, notes, and snippets.

View toranb's full-sized avatar

Toran Billups toranb

View GitHub Profile
@toranb
toranb / ember-integration-test-with-multi-select.js
Created August 26, 2015 21:02
a simple ember example showing how to select multiple items in a "multi select" (integration testing)
test('multi select in a ember integration test', function(assert) {
//setup your model and other component state ...
this.render(hbs`{{my-multi-select model=model options=options}}`);
this.$('.some-multi-select > option[value="' + MY_NEW_ID + '"]').prop('selected',true).trigger('change');
assert.equal(model.get('related_things').get('length'), new_count_with_added_item);
});
@toranb
toranb / store.js
Created March 24, 2014 22:17 — forked from tomdale/store.js
function buildRecord(type, data, store) {
var containerKey = 'model:' + type;
var factory = store.container.lookupFactory(containerKey);
var record = factory.create({
id: data.id,
$data: data
});
@toranb
toranb / eak-lite-sample.js
Created April 9, 2014 03:14
the basic js app
App = Ember.Application.create();
App.Router.map(function() {
this.resource("people", { path: "/" });
});
App.PeopleRoute = Ember.Route.extend({
model: function() {
return App.Person.find();
}
@toranb
toranb / index.html
Created April 9, 2014 03:26
the basic index.html file for eak-lite blog series
<!DOCTYPE html>
<html>
<head>
<title>example app</title>
</head>
<body>
<script src='js/vendor/jquery/jquery.min.js'></script>
<script src='js/vendor/handlebars/handlebars.js'></script>
<script src='js/vendor/ember/ember.min.js'></script>
@toranb
toranb / step2.js
Created April 10, 2014 03:24
added grunt / grunt-cli / grunt-contrib-concat
{
"dependencies": {
"bower": "*",
"grunt": "*",
"grunt-cli": "*",
"grunt-contrib-concat": "*"
},
"scripts": {
"postinstall": "bower install"
}
@toranb
toranb / step2-gruntfile.js
Created April 10, 2014 03:27
added simple grunt file w/ concat logic
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.initConfig({
concat: {
dist: {
src: [
'js/vendor/jquery/jquery.min.js',
'js/vendor/handlebars/handlebars.js',
'js/vendor/ember/ember.min.js',
@toranb
toranb / step2-index.html
Created April 10, 2014 03:32
updated index.html w/ single js asset file referenced
<!DOCTYPE html>
<html>
<head>
<title>example app</title>
</head>
<body>
<script src='js/dist/deps.min.js'></script>
<script type="text/x-handlebars" data-template-name="application">
{{outlet}}
@toranb
toranb / step3-gruntfile.js
Last active August 29, 2015 13:58
added handlebars precompile step
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-ember-template-compiler');
grunt.initConfig({
emberhandlebars: {
compile: {
options: {
templateName: function(sourceFile) {
var newSource = sourceFile.replace('js/templates/', '');
return newSource.replace('.handlebars', '');
@toranb
toranb / step3-package.json
Created April 10, 2014 04:10
added grunt-ember-template-compiler
{
"dependencies": {
"bower": "*",
"grunt": "*",
"grunt-cli": "*",
"grunt-contrib-concat": "*",
"grunt-ember-template-compiler": "1.5.0"
},
"scripts": {
"postinstall": "bower install"
@toranb
toranb / step4-es6.js
Last active August 29, 2015 13:59
adding the transpiler to the Gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-es6-module-transpiler');
grunt.initConfig({
transpile: {
app: {
type: 'amd',
moduleName: function(path) {
return 'example/' + path;
},