Sha256: 094f93d34a35beff7c13230800c655fa2a57cc51e46b7e576fb5e1afd6edd1bf

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

var testVar = 'to be updated';

new Test.Unit.Runner({
  
  setup: function() {
    scrollTo(0,0);
    Position.prepare();
    Position.includeScrollOffsets = false;
  },
  
  teardown: function() {
    scrollTo(0,0);
    Position.prepare();
    Position.includeScrollOffsets = false;
  },
  
  testPrepare: function() {
    Position.prepare();
    this.assertEqual(0, Position.deltaX);
    this.assertEqual(0, Position.deltaY);
    scrollTo(20,30);
    Position.prepare();
    this.assertEqual(20, Position.deltaX);
    this.assertEqual(30, Position.deltaY);
  },
  
  testWithin: function() {
    [true, false].each(function(withScrollOffsets) {
      Position.includeScrollOffsets = withScrollOffsets;
      this.assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
      this.assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
      this.assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
      this.assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
    }, this);
    
    scrollTo(20,30);
    Position.prepare();
    Position.includeScrollOffsets = true;
    this.assert(!Position.within($('body_absolute'), 9, 9), 'outside left/top');
    this.assert(Position.within($('body_absolute'), 10, 10), 'left/top corner');
    this.assert(Position.within($('body_absolute'), 10, 19), 'left/bottom corner');
    this.assert(!Position.within($('body_absolute'), 10, 20), 'outside bottom');
  }
});

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
Fingertips-headless-squirrel-0.2.0 test/regression/prototype/unit/tests/position_test.js
Fingertips-headless-squirrel-0.3.0 test/regression/prototype/unit/tests/position_test.js
Fingertips-headless-squirrel-0.4.0 test/regression/prototype/unit/tests/position_test.js
Fingertips-headless-squirrel-0.5.0 test/regression/prototype/unit/tests/position_test.js
alloy-js-test-san-0.1.0 test/regression/prototype/unit/tests/position_test.js
alloy-js-test-san-0.1.1 test/regression/prototype/unit/tests/position_test.js
headless-squirrel-0.5.1 test/regression/prototype/unit/tests/position_test.js