Sha256: 3887e1b4d23170c207a0da4ed3c350f48aeb4788c5c98c932793184cc5576353

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

module('core', {
  setup: function () {
    this.$tabs = $('#tabs1');
    $(document).abstractio('tabs');
  },
  teardown: function () {

  }
});
test('setup is correct', function () {
  ok(this.$tabs.length == 1, 'one one set of tabs should be present');
  strictEqual(this.$tabs.find('a:last').hasClass('active'), false, 'last tab should not be active');
});
test('click tab activates content pane', function () {
  var $activeTab = this.$tabs.find('.active a'),
      $activeTabContent = $($activeTab.attr('href') + 'Tab'),
      $lastTab = this.$tabs.find('a:last'),
      $lastTabContent = $($lastTab.attr('href') + 'Tab');

  strictEqual($activeTabContent.hasClass('active'), true, 'active tab content should be active');

  $lastTab.trigger('click');

  strictEqual($activeTabContent.hasClass('active'), false, 'previous tab content should no longer be active');
  strictEqual($lastTabContent.hasClass('active'), true, 'newly clicked tab should be active');
});

module('initialize with wrong scope', {
  setup: function () {
    this.$tabs = $('#tabs1');
    $('#tabs2').abstractio('tabs');
  },
  teardown: function () {

  }
});
test('setup is correct', function () {
  ok(this.$tabs.length == 1, 'one one set of tabs should be present');
  strictEqual(this.$tabs.find('a:last').hasClass('active'), false, 'last tab should not be active');
});
test('click tab activates content pane', function () {
  var $activeTab = this.$tabs.find('.active a'),
      $activeTabContent = $($activeTab.attr('href') + 'Tab'),
      $lastTab = this.$tabs.find('a:last'),
      $lastTabContent = $($lastTab.attr('href') + 'Tab');

  strictEqual($activeTabContent.hasClass('active'), true, 'active tab content should be active');

  // triggering an event on an uninitialized tabs should have no effect
  $lastTab.trigger('click');

  strictEqual($activeTabContent.hasClass('active'), true, 'previous tab should still be active');
  strictEqual($lastTabContent.hasClass('active'), false, 'newly clicked tab should be NOT active');
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
themepile-abstractio-4.1.7 docs/js/tests/tabs/simple_tabs.js