Skip to content

Commit

Permalink
Merge branch '2.1.2-wip' of github.com:twitter/bootstrap into 2.1.2-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fat committed Oct 18, 2012
2 parents ac6625d + 0a3e034 commit 8e6697f
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 21 deletions.
7 changes: 3 additions & 4 deletions docs/assets/js/bootstrap-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@
that.$element
.addClass('in')
.attr('aria-hidden', false)
.focus()

that.enforceFocus()

transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
that.$element.focus().trigger('shown')

})
}
Expand Down Expand Up @@ -232,4 +231,4 @@
})
})

}(window.jQuery);
}(window.jQuery);
8 changes: 4 additions & 4 deletions docs/assets/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,13 +794,12 @@
that.$element
.addClass('in')
.attr('aria-hidden', false)
.focus()

that.enforceFocus()

transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
that.$element.focus().trigger('shown')

})
}
Expand Down Expand Up @@ -956,7 +955,8 @@
})
})

}(window.jQuery);/* ===========================================================
}(window.jQuery);
/* ===========================================================
* bootstrap-tooltip.js v2.1.2
* http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame
Expand Down
8 changes: 2 additions & 6 deletions docs/assets/js/bootstrap.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/bootstrap-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
var $this = $(this), href
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
$target.carousel(options)
e.preventDefault()
})
Expand Down
7 changes: 3 additions & 4 deletions js/bootstrap-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,12 @@
that.$element
.addClass('in')
.attr('aria-hidden', false)
.focus()

that.enforceFocus()

transition ?
that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
that.$element.trigger('shown')
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
that.$element.focus().trigger('shown')

})
}
Expand Down Expand Up @@ -232,4 +231,4 @@
})
})

}(window.jQuery);
}(window.jQuery);
5 changes: 3 additions & 2 deletions js/bootstrap-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@
this.enabled = !this.enabled
}

, toggle: function () {
this[this.tip().hasClass('in') ? 'hide' : 'show']()
, toggle: function (e) {
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
self[self.tip().hasClass('in') ? 'hide' : 'show']()
}

, destroy: function () {
Expand Down
21 changes: 21 additions & 0 deletions js/tests/unit/bootstrap-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,25 @@ $(function () {
.carousel('next')
})

test("should set interval from data attribute", 3,function () {
var template = $('<div id="myCarousel" class="carousel slide"> <div class="carousel-inner"> <div class="item active"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}First Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Second Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> <div class="item"> <img alt=""> <div class="carousel-caption"> <h4>{{_i}}Third Thumbnail label{{/i}}</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a> </div>');
template.attr("data-interval", 1814);

template.appendTo("body");
$('[data-slide]').first().click();
ok($('#myCarousel').data('carousel').options.interval == 1814);
$('#myCarousel').remove();

template.appendTo("body").attr("data-modal", "foobar");
$('[data-slide]').first().click();
ok($('#myCarousel').data('carousel').options.interval == 1814, "even if there is an data-modal attribute set");
$('#myCarousel').remove();

template.appendTo("body");
$('[data-slide]').first().click();
$('#myCarousel').attr('data-interval', 1860);
$('[data-slide]').first().click();
ok($('#myCarousel').data('carousel').options.interval == 1814, "attributes should be read only on intitialization");
$('#myCarousel').remove();
})
})
8 changes: 8 additions & 0 deletions js/tests/unit/bootstrap-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,12 @@ $(function () {
ok(!$._data(tooltip[0], 'events').mouseover && !$._data(tooltip[0], 'events').mouseout, 'tooltip does not have any events')
})

test("should show tooltip with delegate selector on click", function () {
var div = $('<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>')
var tooltip = div.appendTo('#qunit-fixture')
.tooltip({ selector: 'a[rel=tooltip]',
trigger: 'click' })
div.find('a').trigger('click')
ok($(".tooltip").is('.fade.in'), 'tooltip is faded in')
})
})

0 comments on commit 8e6697f

Please sign in to comment.