SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fluid.defaults("fluid.tests.transformStep", {
  2.     gradeNames: ["fluid.component"],
  3.     events: {
  4.         transform: null
  5.     },
  6.     listeners: {
  7.         transform: [{
  8.             funcName: "fluid.identity",
  9.             args: ["first"],
  10.             priority: 20,
  11.             namespace: "step1"
  12.         }, {
  13.             funcName: "fluid.identity",
  14.             args: [{
  15.                 step1: "{arguments}.0",
  16.                 step2: "second"
  17.             }],
  18.             priority: 10,
  19.             namespace: "step2"
  20.         }]
  21.     }
  22. });
  23.  
  24. fluid.defaults("fluid.tests.overrideTransformStep", {
  25.     gradeNames: ["fluid.component"],
  26.     components: {
  27.         transformStep: {
  28.             type: "fluid.tests.transformStep"
  29.         }
  30.     },
  31.     distributeOptions: {
  32.         override: {
  33.             record: {
  34.                 funcName: "fluid.identity",
  35.                 args: ["override first"],
  36.                 priority: 20,
  37.                 namespace: "step1"
  38.             },
  39.             target: "{that > transformStep}.options.listeners.transform"
  40.         }
  41.     }
  42. });
  43.  
  44. jqUnit.test("Override a specific step in the promise chain by its namespace", function () {
  45.     jqUnit.expect(1);
  46.     var thatWithOverride = fluid.tests.overrideTransformStep();
  47.     var transformedWithOverride = fluid.promise.fireTransformEvent(thatWithOverride.transformStep.events.transform);
  48.     transformedWithOverride.then(function (value) {
  49.         jqUnit.assertDeepEq("With overriding: Received expected transformed value", {
  50.             step1: "override first",
  51.             step2: "second"
  52.         }, value);
  53.     });
  54. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top