Sha256: f87c94557a8210a378a9907541c192d1ec5a16fc9352aae7d0362198173cbd02

Contents?: true

Size: 1.18 KB

Versions: 60

Compression:

Stored size: 1.18 KB

Contents

describe("stick-at-top-when-scrolling", function(){
  var $stickyElement,
      $stickyWrapper;

  beforeEach(function(){
    $stickyElement = $('<div class="stick-at-top-when-scrolling"></div>');
    $stickyWrapper = $('<div>').append($stickyElement);

    $('body').append($stickyWrapper);
  });

  afterEach(function(){
    $stickyWrapper.remove();
  });

  it('should add fixed class on stick', function(){
    expect(!$stickyElement.hasClass('content-fixed')).toBe(true);
    GOVUK.stickAtTopWhenScrolling.stick($stickyElement);
    expect($stickyElement.hasClass('content-fixed')).toBe(true);
  });

  it('should remove fixed class on release', function(){
    $stickyElement.addClass('content-fixed');
    GOVUK.stickAtTopWhenScrolling.release($stickyElement);
    expect(!$stickyElement.hasClass('content-fixed')).toBe(true);
  });

  it('should insert shim when sticking content', function(){
    expect($('.shim').length).toBe(0);
    GOVUK.stickAtTopWhenScrolling.stick($stickyElement);
    expect($('.shim').length).toBe(1);
  });

  it('should insert shim with minimum height', function(){
    GOVUK.stickAtTopWhenScrolling.stick($stickyElement);
    expect($('.shim').height()).toBe(1);
  });
});

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
govuk_frontend_toolkit-4.18.2 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.18.1 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.18.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.17.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.16.1 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.16.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.15.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.14.1 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.14.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.13.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.12.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.11.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.10.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.9.1 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.9.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.8.2 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.8.1 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.8.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.7.0 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js
govuk_frontend_toolkit-4.6.1 app/assets/spec/unit/stick-at-top-when-scrolling.spec.js