Permalink
Browse files

tabs works again

  • Loading branch information...
1 parent 36e9527 commit 3459d6211d1fbb74dfe14e216b4d365aac980ef7 @justinbmeyer justinbmeyer committed Feb 7, 2013
Showing with 109 additions and 104 deletions.
  1. +7 −4 .gitmodules
  2. +1 −0 can
  3. +1 −1 funcunit
  4. +1 −1 jquery
  5. +0 −15 srchr/tabs/funcunit.html
  6. +0 −1 srchr/tabs/funcunit/funcunit.js
  7. +0 −26 srchr/tabs/funcunit/tabs_test.js
  8. +0 −34 srchr/tabs/tabs.css
  9. +2 −2 srchr/tabs/tabs.html
  10. +12 −19 srchr/tabs/tabs.js
  11. +36 −0 srchr/tabs/tabs.less
  12. +43 −0 srchr/tabs/tabs_test.js
  13. +5 −0 srchr/tabs/test.html
  14. +1 −1 steal
View
@@ -1,12 +1,15 @@
+[submodule "can"]
+ path = can
+ url = git://github.com/bitovi/canjs
[submodule "jquery"]
path = jquery
- url = git@github.com:jupiterjs/jquerymx.git
+ url = git://github.com/bitovi/jquerypp.git
[submodule "steal"]
path = steal
- url = git@github.com:jupiterjs/steal.git
+ url = git://github.com/bitovi/steal.git
[submodule "funcunit"]
path = funcunit
- url = git@github.com:jupiterjs/funcunit.git
+ url = git://github.com/bitovi/funcunit.git
[submodule "documentjs"]
path = documentjs
- url = git@github.com:jupiterjs/documentjs.git
+ url = git://github.com/bitovi/documentjs.git
1 can
Submodule can added at f16f5f
Submodule funcunit updated 97 files
+1 −0 .gitignore
+1 −1 .gitmodules
+160 −13 README.md
+29 −20 browser/actions.js
+5 −0 browser/adapters/adapters.js
+21 −0 browser/adapters/jasmine.js
+16 −0 browser/adapters/qunit.js
+8 −0 browser/adapters/test/app.js
+16 −0 browser/adapters/test/jasmine.html
+10 −0 browser/adapters/test/jasmine.js
+15 −0 browser/adapters/test/qunit.html
+9 −0 browser/adapters/test/qunit.js
+38 −222 browser/core.js
+6 −12 browser/events.js
+22 −11 browser/getters.js
+6 −0 browser/init.js
+500 −0 browser/lib/jquery-migrate-1.1.0.js
+54 −35 browser/open.js
+12 −6 browser/queue.js
+4,997 −4,539 browser/resources/jquery.js
+3 −1 browser/resources/json.js
+4 −12 browser/traversers.js
+14 −3 browser/waits.js
+0 −76 build.js
+0 −10 commandline/envjs.js
+0 −55 commandline/events.js
+0 −10 commandline/phantomjs.js
+0 −21 commandline/selenium.js
+0 −56 commandline/utils.js
+0 −280 coverage/coverage.css
+0 −37 coverage/coverage.html
+0 −217 coverage/coverage.js
+0 −96 dashboard.html
+0 −63 docs.html
+16 −14 funcunit.html
+14 −13 funcunit.js
+0 −8 generate_docs.html
+0 −63 index.html
+15 −0 node/client.js
+38 −0 node/phantom.js
+8 −0 node/run.js
+21 −0 open/envjs
+0 −0 open/output/json2.js
+12 −15 open/output/output.js
+19 −0 open/phantomjs
+31 −0 open/selenium
+102 −0 open/utils.js
+9 −0 package.json
+13 −34 pages/coverage.md
+1 −1 pages/demos.md
+1 −1 pages/envjs.md
+1 −9 pages/features.md
+73 −0 pages/grunt.md
+29 −90 pages/integrations.md
+4 −4 pages/jenkins.md
+3 −10 pages/maven.md
+49 −13 pages/phantomjs.md
+18 −24 pages/selenium.md
+0 −24 qunit.html
+1,978 −0 qunit/qunit-1.10.js
+36 −27 qunit/qunit.css
+69 −1,636 qunit/qunit.js
+102 −0 reporters/console.js
+0 −28 run
+ selenium/selenium-server-standalone-2.28.0.jar
+9 −32 selenium/selenium.js
+27 −25 selenium/user-extensions.js
+0 −17 settings.js
+0 −63 summary.ejs
+1 −1 syn
+1 −1 test/autosuggest/autosuggest.js
+0 −82 test/autosuggest/js/jquery-ui-1.8.16.custom.min.js
+2,534 −0 test/autosuggest/js/jquery-ui-1.9.1.custom.js
+1 −0 test/confirm.html
+23 −0 test/coverage/test.html
+14 −0 test/coverage/widget.html
+35 −0 test/coverage/widget.js
+42 −0 test/coverage/widget_test.js
+1 −2 test/drag/drag.js
+1,722 −0 test/dragdrop.js
+1 −2 test/findclosest.html
+21 −0 test/funcunit/actions_test.js
+3 −4 test/funcunit/find_closest_test.js
+9 −8 test/funcunit/funcunit.js
+13 −3 test/funcunit/funcunit_test.js
+3 −3 test/funcunit/iframe_test.js
+12 −15 test/funcunit/open_test.js
+29 −12 test/funcunit/syn_test.js
+2 −2 test/iframe/haveframe.html
+1 −0 test/iframe/iframe.html
+1 −0 test/iframe/iframe2.html
+3 −2 test/iframe/replaceframe.html
+7 −2 test/myapp.html
+1 −0 test/open/first.html
+2 −3 test/open/second.html
+0 −2 test/qunit/qunit.js
+24 −0 test/scroll.html
2 jquery
Submodule jquery updated 253 files
View
@@ -1,15 +0,0 @@
-<html>
- <head>
- <link rel="stylesheet" type="text/css" href="../../funcunit/qunit/qunit.css" />
- <title>Srchr Tabs FuncUnit Test</title>
- </head>
- <body>
-
- <h1 id="qunit-header">Srchr Tabs Test Suite</h1>
- <h2 id="qunit-banner"></h2>
- <div id="qunit-testrunner-toolbar"></div>
- <h2 id="qunit-userAgent"></h2>
- <ol id="qunit-tests"></ol>
- <script type='text/javascript' src='../../steal/steal.js?srchr/tabs/funcunit'></script>
- </body>
-</html>
@@ -1 +0,0 @@
-steal("funcunit").then('./tabs_test.js')
@@ -1,26 +0,0 @@
-module("srchr/tabs",{
- setup : function(){
- S.open('//srchr/tabs/tabs.html')
- }
-});
-
-
-test("Proper hiding and showing", function() {
- S("li:eq(1)").click();
- S("div:eq(1)").visible(function() {
- equals(S("div:eq(0)").css('display'), 'none', "Old tab contents are hidden");
- ok(!S("li:eq(0)").hasClass('active'), 'Old tab is not set to active');
- equals(S("div:eq(1)").css('display'), 'block', "New tab contents are visible");
- ok(S("li:eq(1)").hasClass('active'), 'New tab is set to active');
- });
-});
-
-test("Clicking twice doesn't break anything", function() {
- S("li:eq(2)").click();
- S("li:eq(2)").click();
-
- S("div:eq(2)").visible(function() {
- equals(S("div:eq(2)").css('display'), 'block', "New tab contents are visible");
- ok(S("li:eq(2)").hasClass('active'), 'New tab is set to active');
- });
-});
View
@@ -1,34 +0,0 @@
-
-.srchr_tabs { padding: 0px; margin: 12px 0 0 10px; }
-.srchr_tabs li {
- float: left;
- padding: 0px;
- list-style: none;
- margin-left: 10px;
-}
-.srchr_tabs li a {
- color: #1C94C4;
- font-weight: bold;
- text-decoration: none;
- padding: 5px;
- font-size: 13px;
-}
-.srchr_tabs li.active a {
- color: white;
- cursor: default;
- background: #666;
- padding: 5px 13px;
- -webkit-border-radius: 30px;
- -moz-border-radius: 30px;
- border-radius: 30px;
-
-}
-
-/* clearfix from jQueryUI */
-.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
-.ui-helper-clearfix { display: inline-block; }
-/* required comment for clearfix to work in Opera \*/
-* html .ui-helper-clearfix { height:1%; }
-.ui-helper-clearfix { display:block; }
-/* end clearfix */
-​
View
@@ -30,8 +30,8 @@ <h2>Demo</h2>
</script>
<script type='text/javascript' >
- steal('srchr/tabs', function(){
- $('#resultsTab').srchr_tabs();
+ steal('srchr/tabs', function(Tabs){
+ new Tabs('#resultsTab');
})
View
@@ -1,4 +1,4 @@
-steal('jquery/controller', 'jquery/event/default', './tabs.css').then(function() {
+steal('can', 'jquery/event/pause', './tabs.less', function(can) {
/**
* A basic tabs controller for showing and hiding content.
@@ -22,24 +22,24 @@ steal('jquery/controller', 'jquery/event/default', './tabs.css').then(function()
*
* @tag controllers, home
*/
- $.Controller("Srchr.Tabs",
- /* @prototype */
+ return can.Control(
+ /** @prototype */
{
/**
* Initialize a new Tabs controller.
* @param {Object} el The UL element to create the tabs controller on
*/
init: function( el ) {
-
// activate the first tab
this.activate($(el).children("li:first"));
// hide other tabs
var tab = this.tab;
- this.element.addClass('ui-helper-clearfix').children("li:gt(0)").each(function() {
- tab($(this)).hide();
- });
+ this.element.addClass('tabs ui-helper-clearfix')
+ .children("li:gt(0)").each(function() {
+ tab($(this)).hide();
+ });
},
// helper function finds the tab for a given li
@@ -59,24 +59,17 @@ steal('jquery/controller', 'jquery/event/default', './tabs.css').then(function()
*/
"li click": function( el, ev ) {
ev.preventDefault();
- el.trigger("activate");
- },
-
- /**
- * Default event handler for the "activate" event.
- * @param {Object} el The element to activate
- * @param {Object} ev The event that was fired.
- */
- "li default.activate": function( el, ev ) {
- this.activate(el);
+ var self = this;
+ el.triggerAsync("activate", function(){
+ self.activate(el);
+ });
},
-
/**
* Hide all tabs, show the new one.
* @param {Object} The element to show.
*/
activate: function( el ) {
- this.tab(this.find('.active').removeClass('active')).hide();
+ this.tab(this.element.find('.active').removeClass('active')).hide();
this.tab(el.addClass('active')).show().trigger("show");
}
});
View
@@ -0,0 +1,36 @@
+.tabs {
+ padding: 0px; margin: 12px 0 0 10px;
+ li {
+ float: left;
+ padding: 0px;
+ list-style: none;
+ margin-left: 10px;
+ a {
+ color: #1C94C4;
+ font-weight: bold;
+ text-decoration: none;
+ padding: 5px;
+ font-size: 13px;
+ }
+ }
+
+ li.active a {
+ color: white;
+ cursor: default;
+ background: #666;
+ padding: 5px 13px;
+ -webkit-border-radius: 30px;
+ -moz-border-radius: 30px;
+ border-radius: 30px;
+
+ }
+}
+
+/* clearfix from jQueryUI */
+.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
+.ui-helper-clearfix { display: inline-block; }
+/* required comment for clearfix to work in Opera \*/
+* html .ui-helper-clearfix { height:1%; }
+.ui-helper-clearfix { display:block; }
+/* end clearfix */
+​
View
@@ -0,0 +1,43 @@
+steal("srchr/tabs","funcunit",function(Tabs, S){
+
+var tabsHTML ="<ul id='resultsTab'>\
+ <li><a href='#flickr'>Flickr</a></li>\
+ <li><a href='#yahoo'>Yahoo</a></li>\
+ <li><a href='#upcoming'>Upcoming</a></li>\
+</ul>\
+<div id='flickr' class='tab'>one</div>\
+<div id='yahoo' class='tab'>two</div>\
+<div id='upcoming' class='tab'>three</div>";
+
+
+ module("srchr/tabs",{
+ setup : function(){
+ $("#qunit-test-area").html(tabsHTML);
+ new Tabs("#resultsTab")
+ },
+ teardown: function(){
+ $("#qunit-test-area").empty()
+ }
+ });
+
+
+ test("Proper hiding and showing", function() {
+ S("[href=\\#yahoo]").click();
+ S("#yahoo").visible(function() {
+ equals(S("#flickr").css('display'), 'none', "Old tab contents are hidden");
+ ok(!S("[href=\\#flickr]").parent().hasClass('active'), 'Old tab is not set to active');
+ ok(S("[href=\\#yahoo]").parent().hasClass('active'), 'New tab is set to active');
+ });
+ });
+
+ test("Clicking twice doesn't break anything", function() {
+ S("[href=\\#upcoming]").click();
+ S("[href=\\#upcoming]").click();
+
+ S("#upcoming").visible(function() {
+ equals(S("#upcoming").css('display'), 'block', "New tab contents are visible");
+ ok(S("[href=\\#upcoming]").parent().hasClass('active'), 'New tab is set to active');
+ });
+ });
+
+})
View
@@ -0,0 +1,5 @@
+<html>
+ <body>
+ <script src='../../steal/steal.js?srchr/tabs/tabs_test.js'></script>
+ </body>
+</html>
2 steal
Submodule steal updated from 2fec49 to 5ccd8e

0 comments on commit 3459d62

Please sign in to comment.