Ejemplo n.º 1
0
import { ArrayTests } from 'ngular-runtime/tests/suites/array';

import insertAtTests from 'ngular-runtime/tests/suites/mutable_array/insertAt';
import popObjectTests from 'ngular-runtime/tests/suites/mutable_array/popObject';
import pushObjectTests from 'ngular-runtime/tests/suites/mutable_array/pushObject';
import pushObjectsTest from 'ngular-runtime/tests/suites/mutable_array/pushObjects';
import removeAtTests from 'ngular-runtime/tests/suites/mutable_array/removeAt';
import replaceTests from 'ngular-runtime/tests/suites/mutable_array/replace';
import shiftObjectTests from 'ngular-runtime/tests/suites/mutable_array/shiftObject';
import unshiftObjectTests from 'ngular-runtime/tests/suites/mutable_array/unshiftObject';
import reverseObjectsTests from 'ngular-runtime/tests/suites/mutable_array/reverseObjects';

var MutableArrayTests = ArrayTests.extend();
MutableArrayTests.importModuleTests(insertAtTests);
MutableArrayTests.importModuleTests(popObjectTests);
MutableArrayTests.importModuleTests(pushObjectTests);
MutableArrayTests.importModuleTests(pushObjectsTest);
MutableArrayTests.importModuleTests(removeAtTests);
MutableArrayTests.importModuleTests(replaceTests);
MutableArrayTests.importModuleTests(shiftObjectTests);
MutableArrayTests.importModuleTests(unshiftObjectTests);
MutableArrayTests.importModuleTests(reverseObjectsTests);

export default MutableArrayTests;
Ejemplo n.º 2
0
  length: computed(function() {
    return this._content.length;
  })
});


ArrayTests.extend({

  name: 'Basic Mutable Array',

  newObject(ary) {
    ary = ary ? ary.slice() : this.newFixture(3);
    return new TestArray(ary);
  },

  // allows for testing of the basic enumerable after an internal mutation
  mutate(obj) {
    obj.addObject(this.getFixture(1)[0]);
  },

  toArray(obj) {
    return obj.slice();
  }

}).run();

QUnit.test("the return value of slice has Ngular.Array applied", function() {
  var x = NgularObject.createWithMixins(NgularArray, {
    length: 0
  });
  var y = x.slice(1);