bootstrap-affix.js 797 B

12345678910111213141516171819202122232425
  1. $(function () {
  2. module("bootstrap-affix")
  3. test("should provide no conflict", function () {
  4. var affix = $.fn.affix.noConflict()
  5. ok(!$.fn.affix, 'affix was set back to undefined (org value)')
  6. $.fn.affix = affix
  7. })
  8. test("should be defined on jquery object", function () {
  9. ok($(document.body).affix, 'affix method is defined')
  10. })
  11. test("should return element", function () {
  12. ok($(document.body).affix()[0] == document.body, 'document.body returned')
  13. })
  14. test("should exit early if element is not visible", function () {
  15. var $affix = $('<div style="display: none"></div>').affix()
  16. $affix.data('affix').checkPosition()
  17. ok(!$affix.hasClass('affix'), 'affix class was not added')
  18. })
  19. })