This file contains hidden or 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 addOnClickTests ( context ) { | |
let model, view, behavior, options; | |
beforeEach( () => { | |
model = new context.ModelClass(); | |
view = new context.ViewClass( { model: model } ); | |
// Retrieve instantiated behavior and its actual options under this context. | |
behavior = _.findWhere( view._behaviors, { id: "addOnClick" } ); |
This file contains hidden or 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( "Like View", () => { | |
const View = LikeView.extend( { template: _.template( "" ) } ); | |
describe( "AddOnClick Behavior", () => { | |
addOnClickTests( { ViewClass: View, ModelClass: LikeModel } ); | |
} ); |
This file contains hidden or 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 addOnClickTests ( context ) { | |
let model, view; | |
beforeEach( () => { | |
model = new context.ModelClass(); | |
view = new context.ViewClass( { model: model } ); | |
} ); | |
it( "should increase the model size by 1 when we click on the view", () => { |
This file contains hidden or 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( "Alert Behavior", () => { | |
let view; | |
beforeEach( () => { | |
view = Marionette.ItemView.extend( { | |
template: _.template( "" ), | |
behaviors: { |
This file contains hidden or 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
const ShareView = Marionette.ItemView.extend( { | |
template: "#card", | |
behaviors: { | |
AlertOnShare: { | |
behaviorClass: AlertBehavior, | |
title: "Shared", | |
message: "Your message has been shared!" | |
} |
This file contains hidden or 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
const Alert = Marionette.Behavior.extend( { | |
defaults: { | |
title: "Alert!", | |
message: "Not really urgent" | |
}, | |
events: { | |
"click": "emitAlert" | |
}, |
This file contains hidden or 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
module.exports = ( plop ) => { | |
plop.setGenerator( "module", { | |
prompts: [ | |
{ | |
type: "input", | |
name: "name", | |
message: "What is the name of your module?", | |
validate: isNotEmptyFor( "name" ), |
This file contains hidden or 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
import Module from "core/module"; | |
import _ from "lodash"; | |
// IMPORT MODULE FILES | |
import Model from "./calendars.model"; | |
const namespace = "calendars"; | |
Model = Model.extend( { namespace: namespace } ); |
This file contains hidden or 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
import Module from "core/module"; | |
import _ from "lodash"; | |
// IMPORT MODULE FILES | |
const namespace = "calendars"; | |
export default Module.extend( { | |
initialize() { |
This file contains hidden or 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
/** | |
* TODO - Describe what your model does. | |
* | |
* @class Calendars.Model | |
* @module Calendars | |
* @constructor | |
*/ | |
import {Model} from "backbone"; | |
export default Model.extend( { |