diff options
author | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-02 21:46:44 +0000 |
---|---|---|
committer | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-02 21:46:44 +0000 |
commit | 421fd14402ad720e3a248af741138436da982560 (patch) | |
tree | 636b568cb310c11f024fb18c447e0b65cb9541dc /ui/webui | |
parent | 5da2f8b85951d3a2d989a1be183efa79c1c7243b (diff) | |
download | chromium_src-421fd14402ad720e3a248af741138436da982560.zip chromium_src-421fd14402ad720e3a248af741138436da982560.tar.gz chromium_src-421fd14402ad720e3a248af741138436da982560.tar.bz2 |
Automate test for list_single_selection_model.
BUG=249104
TEST=WebUIResourceBrowserTest
Review URL: https://chromiumcodereview.appspot.com/18191005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209779 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/webui')
-rw-r--r-- | ui/webui/resources/js/cr/ui/list_single_selection_model_test.html | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/ui/webui/resources/js/cr/ui/list_single_selection_model_test.html b/ui/webui/resources/js/cr/ui/list_single_selection_model_test.html deleted file mode 100644 index 00ee451..0000000 --- a/ui/webui/resources/js/cr/ui/list_single_selection_model_test.html +++ /dev/null @@ -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> |