3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file.
7 <link rel="import" href="/tvcm/ui/list_and_associated_view.html">
11 tvcm.unittest.testSuite(function() {
12 var ListAndAssociatedView = tvcm.ui.ListAndAssociatedView;
14 var SimpleView = tvcm.ui.define('div');
15 SimpleView.prototype = {
16 __proto__: HTMLDivElement.prototype,
18 decorate: function() {
19 this.item_ = undefined;
30 test('listViewNamingWithField', function() {
31 var lav = new ListAndAssociatedView();
37 var view = new SimpleView();
40 lav.listProperty = 'x';
42 lav.viewProperty = 'item';
44 var lavListView = lav.listView;
45 assertEquals(3, lavListView.children.length);
46 assertEquals('1', lavListView.children[0].textContent);
49 test('listViewNamingWithProperty', function() {
50 var lav = new ListAndAssociatedView();
66 var view = new SimpleView();
69 lav.listProperty = 'title';
71 lav.viewProperty = 'item';
73 var lavListView = lav.listView;
74 assertEquals(3, lavListView.children.length);
75 assertEquals('1', lavListView.children[0].textContent);
78 test('selectionChangesView', function() {
79 var lav = new ListAndAssociatedView();
85 var view = new SimpleView();
88 lav.listProperty = 'x';
90 lav.viewProperty = 'item';
91 var lavListView = lav.listView;
93 assertEquals(list[0], view.item);
94 lavListView.children[1].selected = true;
95 assertEquals(list[1], view.item);