scrollview-list-unit-test.html revision d84d625d7d43624674286499b8a8e8fe785c83fc
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<html>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<head>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<title>Scrollview List Plugin Tests</title>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<script type="text/javascript" src="/build/yui/yui-min.js"></script>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe</head>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<body class="yui3-skin-sam">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<h1>Scrollview List Plugin Tests</h1>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<p>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div class="header">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <h1>Scrollview 1</h1>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div id="scrollable1" class="yui3-scrollview-loading">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>I am a div with some LI content inside me!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI content 1</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI Content 2</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI Content 3</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Purchased</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Air</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Amelie</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Ben Folds</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Ben Harper</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Blue October</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Bob Dylan</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Cake</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Citizen Cope</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Coldplay</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Dido</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>I am a div with some LI content inside me!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI content 1</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI Content 2</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI Content 3</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Lily Allen</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Purchased on the iPhone</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Purchased</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Air</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Amelie</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Ben Folds</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Ben Harper</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>I am a div with some LI content inside me!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI content 1</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI Content 2</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li class="special">LI Content 3</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Bob Dylan</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Cake</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Citizen Cope</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Coldplay</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Dido</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Foo Fighters</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Lily Allen</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div class="header">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <h1>Scrollview 2 - has divs as immediate children</h1>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div id="scrollable2" class="yui3-scrollview-loading">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>I am a div with some LI content inside me!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI content 1</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI Content 2</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI Content 3</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>I am a div with some LI content inside me!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI content 1</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI Content 2</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI Content 3</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Lily Allen</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Purchased on the iPhone</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Purchased</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Air</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Amelie</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Ben Folds</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Ben Harper</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>I am a div with some LI content inside me!
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI content 1</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI Content 2</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <li>LI Content 3</li>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </ul>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Bob Dylan</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Cake</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Citizen Cope</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Coldplay</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Dido</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Foo Fighters</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe <div>Lily Allen</div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe </div>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
7ffba875a0c7cf118aef7a2c9bfd00c3935e230aGarrett D'Amore </div>
7ffba875a0c7cf118aef7a2c9bfd00c3935e230aGarrett D'Amore
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe</p>
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe<script type="text/javascript">
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe(function() {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe YUI({
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min',
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe allowRollup: false
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe }).use("console", "test", "dump", "scrollview-base", 'scrollview-list', function(Y) {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // Set up the page
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe var ASSERT = Y.Assert,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ARRAYASSERT = Y.ArrayAssert;
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe var myConsole = new Y.Console().render();
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
6d8b5bf1bbeb8c7f1357b3e5836fe664fb0fcc46Richard Lowe var testBasic = new Y.Test.Case({
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe name: "API Tests",
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe svCfg1: {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe contentBox: '#scrollable1',
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe height: 372,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe width: 400,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe flick : {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe minDistance:0,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe minVelocity:0
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe },
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe plugins: [Y.Plugin.ScrollViewList]
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe },
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe svCfg2: {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe contentBox: '#scrollable2',
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe height: 372,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe width: 400,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe flick : {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe minDistance:0,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe minVelocity:0
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe },
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe plugins: [Y.Plugin.ScrollViewList]
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe },
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe //---------------------------------------------
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // Setup and tear down
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe //---------------------------------------------
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe setUp : function () {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe },
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe tearDown : function () {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe },
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe //---------------------------------------------
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe // Instantiation
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe //---------------------------------------------
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe //makes sure only immediate decendant LI and UL's are selected
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe testBasicScrollviewList: function() {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe var sv = new Y.ScrollView(this.svCfg1),
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe cb, id, ul, li, className, special;
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe sv.render();
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe cb = sv.get('contentBox');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe id = cb.get('id');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ul = Y.all('#'+ id +' > ul')
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe li = Y.all('#'+ id +' > ul > li');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe special = Y.all('.special');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ul.each(function(item) {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe className = item.getAttribute('class');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Y.log('checked ul');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Y.Assert.areEqual("yui3-scrollview-list", className, "List Class name not equal");
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe });
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe li.each(function(item) {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe className = item.getAttribute('class');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Y.log('checked li');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Y.Assert.areEqual("yui3-scrollview-item", className, "Item Class name not equal");
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe });
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe special.each(function(item) {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Y.log('checked specials');
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe Y.Assert.isFalse(item.hasClass('yui3-scrollview-item'), "Special LIs should not have class");
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe });
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe
},
testScrollviewListWithDiv: function() {
var sv = new Y.ScrollView(this.svCfg2),
cb, id, li;
cb = sv.get('contentBox');
id = cb.get('id');
li = Y.all('#' + id + ' li');
li.each(function(item) {
Y.log('checked li');
Y.Assert.isFalse(item.hasClass('yui3-scrollview-item'), "these LIs should not have class because they are not immediate decendants");
});
}
});
var suite = new Y.Test.Suite({name:"Scrollview List Test Suite"});
suite.add(testBasic);
Y.Test.Runner.setName("Scrollview Test Runner");
Y.Test.Runner.add(suite);
Y.Test.Runner.run();
});
})();
</script>
</body>
</html>