Skip to content

Instantly share code, notes, and snippets.

@shellandbull
Last active May 25, 2016 11:34
Show Gist options
  • Save shellandbull/b7e5c0713f4707509c0ffdf7ff15eca5 to your computer and use it in GitHub Desktop.
Save shellandbull/b7e5c0713f4707509c0ffdf7ff15eca5 to your computer and use it in GitHub Desktop.
Framework training | Ember.js Resource list

Useful links 🎊

  • Implement an action and an action handler in the route. Using the route-action helper
  • Render a list of elements on a new route, call it learning-actions
  • Implement an action that transitions to another route...do not use {{link-to}}
  • Implement an action that removes items from the list
  • Implement an action that adds an element to the list

Acceptance testing exercises

  • Install ember-cli-mirage & active-model-adapter Set the active model serialiser adapter
  • Add test coverage to the actions-example we worked on yesterday. Make sure all tests are green
  • Generate a model, call it room that has a name, and an address
  • Implement a route /rooms that gets a list of rooms. Use a factory to populate the server’s database.
  • Implement a test where you assert that the route is valid and that a list of rooms are displayed on a UI
  • Implement a feature where, from that route, a user can delete a room. This has to send a DEL request to the server.

Sublime Settings

ctrl+shift+P settings > user

and then copy and paste the following

	"folder_exclude_patterns":
	[
		".svn",
		".git",
		".hg",
		".sass-cache",
		"bower_components",
		"node_modules",
		"dist",
		"CVS",
		"tmp",
		"vcr_cassettes"
	],

Promises dissected

  model() {
    var promiseObject = new RSVP.Promise((_, reject) => {
      reject(new Error('🚀'));
    });

    var toBeExecutedIfThingsGoAllRight = () => {
      console.log('THIS WILL NEVER BE CALLED BECAUSE I AM BROKEN');
    };

    var toBeExecutedOnRejection = (errorObject) => {
      return {
        message: 'this promise was successfully catched',
        errorObject
      };
    };

    var afterEverythingsFinished = () => {
      console.log('the storm has ended, everything is finished');
    };

    return promiseObject
            .then(toBeExecutedIfThingsGoAllRight)
            .catch(toBeExecutedOnRejection)
            .finally(afterEverythingsFinished);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment