Created
September 26, 2013 19:14
-
-
Save amb26/6719134 to your computer and use it in GitHub Desktop.
Very basic FLUID-3674 model relay test
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
fluid.defaults("fluid.tests.changer", { | |
gradeNames: ["fluid.littleComponent", "autoInit"], | |
invokers: { | |
change: { | |
changePath: "{arguments}.0", | |
value: "{arguments.1" | |
} | |
} | |
}); | |
fluid.defaults("fluid.tests.fluid3674head", { | |
gradeNames: ["fluid.standardRelayComponent", "fluid.tests.changer", "fluid.tests.changeRecorder", "autoInit"], | |
model: { // test forward reference as well as transactional initialisation | |
innerModel: "{child}.model.nested1" | |
}, | |
modelListeners: { | |
"innerModel": "{that}.record({change}.path, {change}.value, {change}.oldValue)" | |
}, | |
components: { | |
child: { | |
type: "fluid.tests.changer", | |
options: { | |
gradeNames: ["fluid.standardRelayComponent"], | |
model: { | |
nested1: { | |
nested2: "thing" | |
} | |
} | |
} | |
} | |
} | |
}); | |
jqUnit.test("FLUID-3674 basic model relay test", function () { | |
var that = fluid.tests.fluid3674head(); | |
var expected = { | |
innerModel: { | |
nested2: "thing" | |
} | |
}; | |
jqUnit.assertDeepEq("Model successfully resolved on init", expected, that.model); | |
var expected2 = [{ | |
path: ["innerModel"], oldValue: undefined, value: {nested2: "thing"} | |
}]; | |
jqUnit.assertDeepEq("Registered initial change", expected2, that.fireRecord); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment