Date post: | 13-Jan-2017 |
Category: |
Internet |
Upload: | nicolas-carlo |
View: | 186 times |
Download: | 0 times |
1
TESTERTESTER SES SES BEHAVIORSBEHAVIORS MARIONETTE.JS MARIONETTE.JS
2
@NICOESPEON@NICOESPEONhttp://nicoespeon.com
3 . 1
KEZAKO KEZAKO BEHAVIORS BEHAVIORS ??> PETIT CHECK-UP> PETIT CHECK-UP
3 . 2
FROM ZE DOCSFROM ZE DOCS
http://marionettejs.com/docs/v2.4.3/marionette.behavior.html
“ A Behavior is an isolated set of DOM / user interactionsthat can be mixed into any View or another Behavior.
“ Behaviors allow you to blackbox View-specific interactions intoportable logical chunks, keeping your Views simple and your code DRY.
3 . 3
CONCRÈTEMENTCONCRÈTEMENT
http://slides.com/stephanebachelier/marionettebehaviors#/
Explications, implémentation et détails techniquestrès bien présentés par au
meetup Stéphane Bachelier
Backbone.js Paris S01E06
3 . 4
UN EXEMPLE PRATIQUEUN EXEMPLE PRATIQUE
4 . 1
TESTER SES TESTER SES BEHAVIORSBEHAVIORS, YAKA !, YAKA !> LES PROBLÉMATIQUES> LES PROBLÉMATIQUES
4 . 2
PB #1 : TESTER L'API ?PB #1 : TESTER L'API ?const Alert = Marionette.Behavior.extend( {
defaults: { title: "Alert!", message: "Not really urgent" },
events: { "click": "emitAlert" },
emitAlert() { alert( this.options.message ); }
} );
it( "should emit an alert", () => {
// => This won't work expect( Behavior.emitAlert() ).toEmitAnAlert();
} );
4 . 3
PB #2 : COUPLAGE AVEC LA VUEPB #2 : COUPLAGE AVEC LA VUE
Tester une Behavior indépendamment d'une vue :
beaucoup de setuppeu de valeur ajoutéene vérifie pas que l'interactionBehavior-View fonctionne bien dans notre réalité
4 . 4
PB #3 : DUPLICATION DU CODE DE TESTPB #3 : DUPLICATION DU CODE DE TEST
Tester l'interaction Behavior-View dans chaque test de vue…
5 . 1
SOLUTIONSOLUTION PROPOSÉE PROPOSÉE
https://github.com/nicoespeon/testing-marionette-behaviors
http://www.nicoespeon.com/fr/2015/11/tester-behaviors-marionette/
5 . 2
ARTICLES SUR LA QUESTIONARTICLES SUR LA QUESTION
http://spin.atomicobject.com/2014/09/11/marionette-behaviors-overview/
http://spin.atomicobject.com/2014/09/12/testing-marionette-js-behaviors/
6
MERCI !MERCI ! DES QUESTIONS ? DES QUESTIONS ?