Last active
December 15, 2016 23:08
-
-
Save Kerrick/96355dbe71bf0b74958ba67858c567e9 to your computer and use it in GitHub Desktop.
Reduced Test Case - Reset State
This file contains 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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
value: false, | |
actions: { | |
toggle() { | |
this.toggleProperty('value'); | |
} | |
} | |
}); |
This file contains 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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
screen: Ember.inject.service(), | |
isDesktop: Ember.computed.gte('screen.width', 600), | |
/* | |
//This strategy makes you retain your state until the value of isDesktop changes, but uses observers. | |
watchScreenWidth: Ember.observer('screen.width', function() { | |
this.set('isDesktop', this.get('screen.width') >= 600); | |
}), | |
isDesktop: false, | |
*/ | |
columns: Ember.computed('isDesktop', function() { | |
Ember.Logger.log('Recomputing columns...', new Date().toISOString()); | |
return this.get('isDesktop') ? [[{ foo: 1 }, { foo: 3 }],[{ foo: 2 }, { foo: 4 }]] : [[{ foo: 1 },{ foo: 2 },{ foo: 3 },{ foo: 4 }]]; | |
}), | |
}); |
This file contains 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
{ | |
"version": "0.10.6", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.9.0", | |
"ember-data": "2.9.0", | |
"ember-template-compiler": "2.9.0", | |
"ember-testing": "2.9.0" | |
}, | |
"addons": { | |
"ember-screen": "0.1.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment