| Index: chrome/browser/resources/shared/js/cr/ui/list_single_selection_model_test.html
|
| ===================================================================
|
| --- chrome/browser/resources/shared/js/cr/ui/list_single_selection_model_test.html (revision 177292)
|
| +++ chrome/browser/resources/shared/js/cr/ui/list_single_selection_model_test.html (working copy)
|
| @@ -1,120 +0,0 @@
|
| -<!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| -<title></title>
|
| -<style>
|
| -
|
| -</style>
|
| -<script src="http://closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script>
|
| -<script src="../../cr.js"></script>
|
| -<script src="../event_target.js"></script>
|
| -<script src="list_single_selection_model.js"></script>
|
| -<script src="list_selection_model_test_util.js"></script>
|
| -<script>
|
| -
|
| -goog.require('goog.testing.jsunit');
|
| -
|
| -</script>
|
| -
|
| -</head>
|
| -<body>
|
| -
|
| -<script>
|
| -
|
| -function createSelectionModel(len, opt_dependentLeadItem) {
|
| - var sm = new cr.ui.ListSingleSelectionModel(len);
|
| - sm.independentLeadItem_ = !opt_dependentLeadItem;
|
| - return sm;
|
| -}
|
| -
|
| -function testAdjust1() {
|
| - var sm = createSelectionModel(200);
|
| -
|
| - sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 100;
|
| - adjust(sm, 0, 10, 0);
|
| -
|
| - assertEquals(90, sm.leadIndex);
|
| - assertEquals(90, sm.anchorIndex);
|
| - assertEquals(90, sm.selectedIndex);
|
| -}
|
| -
|
| -function testAdjust2() {
|
| - var sm = createSelectionModel(200);
|
| -
|
| - sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 50;
|
| - adjust(sm, 60, 10, 0);
|
| -
|
| - assertEquals(50, sm.leadIndex);
|
| - assertEquals(50, sm.anchorIndex);
|
| - assertEquals(50, sm.selectedIndex);
|
| -}
|
| -
|
| -function testAdjust3() {
|
| - var sm = createSelectionModel(200);
|
| -
|
| - sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 100;
|
| - adjust(sm, 0, 0, 10);
|
| -
|
| - assertEquals(110, sm.leadIndex);
|
| - assertEquals(110, sm.anchorIndex);
|
| - assertEquals(110, sm.selectedIndex);
|
| -}
|
| -
|
| -function testAdjust4() {
|
| - var sm = createSelectionModel(100);
|
| -
|
| - sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 99;
|
| -
|
| - adjust(sm, 99, 1, 0);
|
| -
|
| - assertEquals('lead', -1, sm.leadIndex);
|
| - assertEquals('anchor', -1, sm.anchorIndex);
|
| - assertArrayEquals([], sm.selectedIndexes);
|
| -}
|
| -
|
| -function testAdjust5() {
|
| - var sm = createSelectionModel(1);
|
| -
|
| - sm.leadIndex = sm.anchorIndex = sm.selectedIndex = 0;
|
| -
|
| - adjust(sm, 0, 0, 10);
|
| -
|
| - assertEquals('lead', 10, sm.leadIndex);
|
| - assertEquals('anchor', 10, sm.anchorIndex);
|
| - assertArrayEquals([10], sm.selectedIndexes);
|
| -}
|
| -
|
| -function testSelectedIndex1() {
|
| - var sm = createSelectionModel(100, true);
|
| -
|
| - sm.selectedIndex = 99;
|
| -
|
| - assertEquals('lead', 99, sm.leadIndex);
|
| - assertEquals('anchor', 99, sm.anchorIndex);
|
| - assertArrayEquals([99], sm.selectedIndexes);
|
| -}
|
| -
|
| -function testLeadIndex1() {
|
| - var sm = createSelectionModel(100);
|
| -
|
| - sm.leadIndex = 99;
|
| -
|
| - assertEquals('lead', 99, sm.leadIndex);
|
| - assertEquals('anchor', 99, sm.anchorIndex);
|
| - assertArrayEquals([], sm.selectedIndexes);
|
| -}
|
| -
|
| -function testLeadIndex2() {
|
| - var sm = createSelectionModel(100, true);
|
| -
|
| - sm.leadIndex = 99;
|
| -
|
| - assertEquals('lead', -1, sm.leadIndex);
|
| - assertEquals('anchor', -1, sm.anchorIndex);
|
| - assertArrayEquals([], sm.selectedIndexes);
|
| -}
|
| -
|
| -</script>
|
| -
|
| -</body>
|
| -</html>
|
|
|