PHP Classes

File: public/js/tinymce/src/core/src/test/js/atomic/util/LazyEvaluatorTest.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra  >  GoLavaCMS  >  public/js/tinymce/src/core/src/test/js/atomic/util/LazyEvaluatorTest.js  >  Download  
File: public/js/tinymce/src/core/src/test/js/atomic/util/LazyEvaluatorTest.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 4 years ago
Size: 1,414 bytes
 

Contents

Class file image Download
asynctest(
  'atomic.tinymce.core.util.LazyEvaluatorTest',
  [
    'ephox.agar.api.Assertions',
    'ephox.agar.api.Pipeline',
    'ephox.agar.api.Step',
    'ephox.katamari.api.Option',
    'tinymce.core.util.LazyEvaluator'
  ],
  function (Assertions, Pipeline, Step, Option, LazyEvaluator) {
    var success = arguments[arguments.length - 2];
    var failure = arguments[arguments.length - 1];

    var sTestEvaluateUntil = Step.sync(function () {
      var operations = [
        function (a, b) {
          return a === 1 && b === 'a' ? Option.some(1) : Option.none();
        },
        function (a, b) {
          return a === 2 && b === 'b' ? Option.some(2) : Option.none();
        },
        function (a, b) {
          return a === 3 && b === 'c' ? Option.some(3) : Option.none();
        }
      ];

      Assertions.assertEq('Should return none', true, LazyEvaluator.evaluateUntil(operations, [123, 'x']).isNone());
      Assertions.assertEq('Should return first item', 1, LazyEvaluator.evaluateUntil(operations, [1, 'a']).getOrDie(1));
      Assertions.assertEq('Should return second item', 2, LazyEvaluator.evaluateUntil(operations, [2, 'b']).getOrDie(2));
      Assertions.assertEq('Should return third item', 3, LazyEvaluator.evaluateUntil(operations, [3, 'c']).getOrDie(3));
    });

    Pipeline.async({}, [
      sTestEvaluateUntil
    ], function () {
      success();
    }, failure);
  }
);
For more information send a message to info at phpclasses dot org.