diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-05-18 09:43:54 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-05-18 10:07:38 -0400 |
commit | 15ccc1ad7a2de6bde1ce0c34f41fb441bdbecaf5 (patch) | |
tree | 0a2d976d0381ec661cc345ca70bdce069f4a0770 /tests/visual/tooltip/tooltip.html | |
parent | 627d27fea23f1fb50db6c9ad8a2ff264505a0f3e (diff) | |
download | jquery-ui-15ccc1ad7a2de6bde1ce0c34f41fb441bdbecaf5.tar.gz jquery-ui-15ccc1ad7a2de6bde1ce0c34f41fb441bdbecaf5.zip |
Tooltip: Cleaned up visual test.
Diffstat (limited to 'tests/visual/tooltip/tooltip.html')
-rw-r--r-- | tests/visual/tooltip/tooltip.html | 302 |
1 files changed, 150 insertions, 152 deletions
diff --git a/tests/visual/tooltip/tooltip.html b/tests/visual/tooltip/tooltip.html index da811645c..e0ff27aa8 100644 --- a/tests/visual/tooltip/tooltip.html +++ b/tests/visual/tooltip/tooltip.html @@ -1,121 +1,104 @@ -<!DOCTYPE html> +<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Tooltip Visual Test: Default</title> - <link rel="stylesheet" href="../visual.css" type="text/css" /> - <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css"> - <script type="text/javascript" src="../../../jquery-1.7.2.js"></script> - <script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script> - <script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script> - <script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script> - <script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script> - <script type="text/javascript" src="../../../ui/jquery.ui.tooltip.js"></script> - <!-- - <script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script> - --> - <script type="text/javascript"> + <link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css"> + <script src="../../../jquery-1.7.2.js"></script> + <script src="../../../ui/jquery.ui.core.js"></script> + <script src="../../../ui/jquery.ui.widget.js"></script> + <script src="../../../ui/jquery.ui.position.js"></script> + <script src="../../../ui/jquery.ui.button.js"></script> + <script src="../../../ui/jquery.ui.tooltip.js"></script> + <style> + .group { + margin-top: 2em; + } + </style> + <script> $(function() { - $.fn.themeswitcher && $('<div/>').css({ - position: "absolute", - right: 10, - top: 10 - }).appendTo(document.body).themeswitcher(); - - function enable() { - // default - $("#context1, form, #childish, #nested-input").tooltip(); - - // custom class, replaces ui-widget-content - $("#context2").tooltip({ - tooltipClass: "ui-widget-header" - }); - $("#right1").tooltip({ - tooltipClass: "ui-state-error" - }); - - // synchronous content - $("#footnotes").tooltip({ - items: "[href^='#']", - content: function() { - return $($(this).attr("href")).html(); - } - }); - // asynchronous content - $("#ajax").tooltip({ - content: function(response) { - $.get("ajaxcontent.php", response); - return "Loading..."; - } - }); - // asynchronous content with caching - var content; - $("#ajax2").tooltip({ - content: function(response) { - if (content) { - return content; - } - $.ajax({ - url: "ajaxcontent.php", - cache: false, - success: function(result) { - content = result; - response(result); - } - }); - return "Loading..."; - } - }); - - // custom position - $("#right2").tooltip({ - tooltipClass: "ui-state-highlight", - position: { - my: "center top", - at: "center bottom", - offset: "0 10" - } - }); + // default + $( "#context1, form, #childish, #nested-input" ).tooltip(); - $("#button1").button(); - $("#button2").button({ - icons: { - primary: "ui-icon-wrench" - } - }); - $("#button3, #button4").button({ - icons: { - primary: "ui-icon-wrench" - }, - text: false - }); - $("#buttons").tooltip({ - position: { - my: "center bottom", - at: "center top", - offset: "0 -5" + // custom class, replaces ui-widget-content + $( "#context2" ).tooltip({ + tooltipClass: "ui-widget-header" + }); + $( "#right1" ).tooltip({ + tooltipClass: "ui-state-error" + }); + + // synchronous content + $( "#footnotes" ).tooltip({ + items: "[href^='#']", + content: function() { + return $( $( this ).attr( "href" ) ).html(); + } + }); + + // asynchronous content + $( "#async" ).tooltip({ + content: function( response ) { + setTimeout(function() { + response( "I loaded <strong>asyncrhonously</strong>!" ); + }, 1000 ); + return "Loading..."; + } + }); + + // asynchronous content with caching + var content; + $( "#async2" ).tooltip({ + content: function( response ) { + if ( content ) { + return content; } - }); - } - enable(); - - $("#disable").toggle(function() { - $(":ui-tooltip").tooltip("disable"); - }, function() { - $(":ui-tooltip").tooltip("enable"); + setTimeout(function() { + content = "<strong>Hello</strong> world!"; + response( content ); + }, 1000 ); + return "Loading..."; + } + }); + + // custom position + $( "#right2" ).tooltip({ + tooltipClass: "ui-state-highlight", + position: { + my: "center top", + at: "center bottom", + offset: "0 10" + } + }); + + $( "#button1" ).button(); + $( "#button2" ).button({ + icons: { + primary: "ui-icon-wrench" + } + }); + $( "#button3, #button4" ).button({ + icons: { + primary: "ui-icon-wrench" + }, + text: false }); - $("#toggle").toggle(function() { - $(":ui-tooltip").tooltip("destroy"); - }, function() { - enable(); + $( "#buttons" ).tooltip({ + position: { + my: "center bottom", + at: "center top", + offset: "0 -5" + } }); }); </script> </head> <body> -<div style="width:300px"> - <ul id="context1" class="ui-widget ui-widget-header"> +<div> + <p>Lots of tooltipped elements close together.<br> + Mouse through them quickly and slowly.</p> + <ul id="context1"> <li><a href="#" title="Tooltip text 1">Anchor 1</a></li> <li><a href="#" title="Tooltip text 2">Anchor 2</a></li> <li><a href="#" title="Tooltip text 3">Anchor 3</a></li> @@ -124,68 +107,83 @@ <li><a href="#" title="Tooltip text 6 more Tooltip text Tooltip text ">Anchor 6</a></li> </ul> - <div id="right1" style="position: absolute; right: 1em" title="right aligned element"> - collision detection should kick in around here - </div> - - <div id="footnotes" style="margin: 2em 0"> - <a href="#footnote1">I'm a link to a footnote.</a> - <a href="#footnote2">I'm another link to a footnote.</a> + <div class="group" style="position: absolute; right: 1em; text-align: right;"> + <p>These elements are right aligned.<br> + One collides and one uses custom position.</p> + <p id="right1" title="right aligned element"> + collision detection should kick in around here + </p> + <p id="right2" title="right aligned element with custom position"> + right aligned with custom position + </p> </div> - <div id="right2" style="position: absolute; right: 1em" title="right aligned element with custom position"> - right aligned with custom position - </div> - - <div id="ajax" style="width: 100px;" class="ui-widget-content" title="never be seen"> - gets its content via ajax - </div> - <div id="ajax2" style="width: 100px;" class="ui-widget-content" title="never be seen"> - gets its content via ajax, caches the response + <div class="group"> + <p>These footnotes pull content form the elements they link to.</p> + <div id="footnotes"> + <a href="#footnote1">I'm a link to a footnote.</a> + <a href="#footnote2">I'm another link to a footnote.</a> + </div> </div> - <div id="context2" class="ui-widget ui-widget-content"> - <span title="something" style="border:1px solid blue">span</span> - <div title="something else" style="border:1px solid red;"> - div - <span title="something more" style="border:1px solid green;">nested span</span> + <div class="group"> + <p>These elements load their content asynchronously.<br> + There should be a loading message while the content is retrieved.</p> + <div id="async" style="width: 100px;" class="ui-widget-content" title="never be seen"> + async + </div> + <div id="async2" style="width: 100px;" class="ui-widget-content" title="never be seen"> + async + cache </div> </div> - <div id="childish" class="ui-widget ui-widget-content" style="margin: 2em 0; border: 1px solid black;" title="element with child elements"> - Text in <strong>bold</strong>. + <div class="group" style="width: 300px;"> + <p>Nested elements.</p> + <div id="context2"> + <div title="something else" style="border:1px solid red;"> + tooltipped + <span title="something more" style="border:1px solid green; padding-left: 50px;">nested tooltipped</span> + </div> + </div> + <div id="childish" style="border: 1px solid black;" title="element with child elements"> + Text in <strong>bold</strong>. + </div> </div> - <form style="margin: 2em 0;"> - <div> - <label for="first">First Name:</label> - <input id="first" title="Your first name is optional" /> - </div> - <div> - <label for="last">Last Name:</label> - <input id="last" title="Your last name is optional" /> + <div class="group"> + <p>Play around with focusing and hovering of form elements.</p> + <form> + <div> + <label for="first">First Name:</label> + <input id="first" title="Your first name is optional"> + </div> + <div> + <label for="last">Last Name:</label> + <input id="last" title="Your last name is optional"> + </div> + </form> + + <p>Some inputs nested inside labels:</p> + <div id="nested-input"> + <label title="test"><input type="checkbox">This is a test</label> + <label title="test2"><input type="checkbox">This is a test</label> + <label><input type="checkbox" title="test3">This is a test</label> + <label><input type="checkbox" title="test4">This is a test</label> </div> - </form> - <div id="nested-input"> - <label title="test"><input type="checkbox">This is a test</label> - <label title="test2"><input type="checkbox">This is a test</label> - <label><input type="checkbox" title="test3">This is a test</label> - <label><input type="checkbox" title="test4">This is a test</label> + <p>Some button widgets:</p> + <div id="buttons"> + <button id="button1" title="Button Tooltip">Button Label</button> + <button id="button2" title="Icon Button">Button with Icon</button> + <button id="button3">Icon Only Button 1</button> + <button id="button4">Icon Only Button 2</button> + </div> </div> - <div id="buttons"> - <button id="button1" title="Button Tooltip">Button Label</button> - <button id="button2" title="Icon Button">Button with Icon</button> - <button id="button3">Icon Only Button 1</button> - <button id="button4">Icon Only Button 2</button> + <div class="group"> + <div id="footnote1">This is <strong>the</strong> footnote, including other elements</div> + <div id="footnote2">This is <strong>the other</strong> footnote, including other elements</div> </div> - - <div id="footnote1">This is <strong>the</strong> footnote, including other elements</div> - <div id="footnote2">This is <strong>the other</strong> footnote, including other elements</div> - - <button id="disable">Toggle disabled</button> - <button id="toggle">Toggle widget</button> </div> <div style="height: 2000px"></div> |