Sha256: f02755d3c67f684c937abd11b6f1c67bd237bf438361531994a0a2fef0af79bc

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

// ==========================================================================
// Project:   SproutCore
// Copyright: ©2014 7x7 Software, Inc.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================
/*global module, test, same, ok, equals*/


var content, view;

module("SC.ListView.layoutForContentIndex", {
  setup: function () {
    content = "1 2 3 4 5 6 7 8 9 0".w().map(function (x) {
      return SC.Object.create({ value: x });
    }, this);

    view = SC.ListView.create({
      content: content,
      rowSize: 50
    });
  },

  teardown: function () {
    view.destroy();
    content = view = null;
  }
});

test("Expected layout objects for each content index in vertical mode.", function () {
  for (var i = 0, len = content.length; i < len; i++) {
    same(view.layoutForContentIndex(i), { left: 0, right: 0, height: 50, top: i * 50 }, "The layout object at index %@ should be".fmt(i));
  }
});

test("Expected layout objects for each content index in horizontal mode.", function () {
  view.set('layoutDirection', SC.LAYOUT_HORIZONTAL);

  for (var i = 0, len = content.length; i < len; i++) {
    same(view.layoutForContentIndex(i), { top: 0, bottom: 0, width: 50, left: i * 50 }, "The layout object at index %@ should be".fmt(i));
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/layoutForContentIndex.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/layoutForContentIndex.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/layoutForContentIndex.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/layoutForContentIndex.js