Sha256: 9280575fe390f1649c32bde4d89cdde56e63f1cea6ae1cc9cde01a98d84f5eea
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
module("SelectViewMenu -- Bindings"); function setValues(obj, props, toValue) { for (var idx = 0; idx < props.length; idx++) { var prop = props[idx]; if (SC.typeOf(prop) === SC.T_HASH) prop = prop.from; obj.set(prop, toValue); } } function validateValues(obj, props, value) { for (var idx = 0; idx < props.length; idx++) { equals(obj.get(props[idx]), value, props[idx]); } } test("Proxying all properties from SelectView to MenuView works.", function() { var proxyProperties = [ 'items', 'target', 'action', 'itemTitleKey', 'itemIsEnabledKey', 'itemValueKey', 'itemIconKey', 'itemHeightKey', 'itemSubMenuKey', 'itemSeparatorKey', 'itemTargetKey', 'itemActionKey', 'itemCheckboxKey', 'itemShortCutKey', 'itemKeyEquivalentKey', 'itemDisableMenuFlashKey', 'preferType', 'preferMatrix' ]; var obj = SC.Object.create({}); setValues(obj, SC.SelectViewMenu._svm_bindToProperties, 'initial'); // Bindings won't evaluate until the end of the run loop, so make a run loop SC.RunLoop.begin(); var menu = SC.Object.create(SC.SelectViewMenu, { selectView: obj }); SC.RunLoop.end(); // test that initial binding worked validateValues(menu, proxyProperties, 'initial'); // now, test updates SC.RunLoop.begin(); setValues(obj, SC.SelectViewMenu._svm_bindToProperties, 'modified'); SC.RunLoop.end(); validateValues(menu, proxyProperties, 'modified'); });
Version data entries
4 entries across 4 versions & 1 rubygems