Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
walsh9 committed Oct 9, 2014
1 parent 5d5d768 commit 3e1079c
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 44 deletions.
16 changes: 4 additions & 12 deletions dist/videojs-transcript.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,11 @@ var eventEmitter = {
h[2].apply();
}
});
},
delegate: function (obj) {
obj.on = function (event, callback) {
eventEmitter.on(obj, event, callback);
};
obj.trigger = function (obj) {
eventEmitter.trigget(obj, event);
};
return obj;
}
};

var scrollerProto = function(plugin) {


var initHandlers = function (el) {
var self = this;
// The scroll event. We want to keep track of when the user is scrolling the transcript.
Expand Down Expand Up @@ -201,7 +191,9 @@ var scrollerProto = function(plugin) {
var init = function (element, plugin) {
this.element = element;
this.userIsScrolling = false;
this.mouseIsOverTranscript = false;

//default to true in case user isn't using a mouse;
this.mouseIsOverTranscript = true;
this.isAutoScrolling = true;
initHandlers.call(this, this.element);
return this;
Expand Down Expand Up @@ -242,7 +234,7 @@ var scrollerProto = function(plugin) {
var parent = element.parentElement;
var parentOffsetBottom = parent.offsetTop + parent.clientHeight;
var elementOffsetBottom = element.offsetTop + element.clientHeight;
var relPos = (element.offsetTop + element.clientHeight) - parent.offsetTop;
var relPos = element.offsetTop - parent.offsetTop;
var newPos;

// If the line is above the top of the parent view, were scrolling up,
Expand Down
2 changes: 1 addition & 1 deletion dist/videojs-transcript.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/scroller.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/*
* Scroller object to handle scrolling.
*/

var scrollerProto = function(plugin) {


var initHandlers = function (el) {
var self = this;
// The scroll event. We want to keep track of when the user is scrolling the transcript.
Expand Down Expand Up @@ -45,7 +43,9 @@ var scrollerProto = function(plugin) {
var init = function (element, plugin) {
this.element = element;
this.userIsScrolling = false;
this.mouseIsOverTranscript = false;

//default to true in case user isn't using a mouse;
this.mouseIsOverTranscript = true;
this.isAutoScrolling = true;
initHandlers.call(this, this.element);
return this;
Expand Down Expand Up @@ -86,7 +86,7 @@ var scrollerProto = function(plugin) {
var parent = element.parentElement;
var parentOffsetBottom = parent.offsetTop + parent.clientHeight;
var elementOffsetBottom = element.offsetTop + element.clientHeight;
var relPos = (element.offsetTop + element.clientHeight) - parent.offsetTop;
var relPos = element.offsetTop - parent.offsetTop;
var newPos;

// If the line is above the top of the parent view, were scrolling up,
Expand Down
12 changes: 11 additions & 1 deletion test/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="qunit-fixture">
<div id="scrollable-container" style="height:100px; overflow-y:scroll">
<div id="item1" style="height: 50px">1</div>
<div id="item2" style="height: 50px">2</div>
<div id="item3" style="height: 50px">3</div>
<div id="item4" style="height: 50px">4</div>
</div>
<div id="non-scrollable-container" style="height:100px;"></div>

</div>
<script src="../node_modules/qunitjs/qunit/qunit.js"></script>
<script>
test('the environment is sane', function() {
ok(true, 'everything is swell');
});
</script>
<script src="../node_modules/video.js/dist/video-js/video.js"></script>
<script src="../src/polyfill.js"></script>
<script src="../src/options.js"></script>
<script src="../src/events.js"></script>
<script src="../src/tracklist.js"></script>
Expand Down
Loading

0 comments on commit 3e1079c

Please sign in to comment.