Commit ee90edae authored by Filipa Lacerda's avatar Filipa Lacerda

Fix broken tests

parent 601dc0d8
...@@ -94,104 +94,102 @@ export default class ImageFile { ...@@ -94,104 +94,102 @@ export default class ImageFile {
}); });
return [maxWidth, maxHeight]; return [maxWidth, maxHeight];
} }
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line
views() { views = {
return { 'two-up': function() {
'two-up': function() { return $('.two-up.view .wrap', this.file).each((function(_this) {
return $('.two-up.view .wrap', this.file).each((function(_this) { return function(index, wrap) {
return function(index, wrap) { $('img', wrap).each(function() {
$('img', wrap).each(function() { var currentWidth;
var currentWidth; currentWidth = $(this).width();
currentWidth = $(this).width(); if (currentWidth > availWidth / 2) {
if (currentWidth > availWidth / 2) { return $(this).width(availWidth / 2);
return $(this).width(availWidth / 2); }
} });
}); return _this.requestImageInfo($('img', wrap), function(width, height) {
return _this.requestImageInfo($('img', wrap), function(width, height) { $('.image-info .meta-width', wrap).text(width + "px");
$('.image-info .meta-width', wrap).text(width + "px"); $('.image-info .meta-height', wrap).text(height + "px");
$('.image-info .meta-height', wrap).text(height + "px"); return $('.image-info', wrap).removeClass('hide');
return $('.image-info', wrap).removeClass('hide'); });
}); };
}; })(this));
})(this)); },
}, 'swipe': function() {
'swipe': function() { var maxHeight, maxWidth;
var maxHeight, maxWidth; maxWidth = 0;
maxWidth = 0; maxHeight = 0;
maxHeight = 0; return $('.swipe.view', this.file).each((function(_this) {
return $('.swipe.view', this.file).each((function(_this) { return function(index, view) {
return function(index, view) { var $swipeWrap, $swipeBar, $swipeFrame, wrapPadding, ref;
var $swipeWrap, $swipeBar, $swipeFrame, wrapPadding, ref; ref = _this.prepareFrames(view), maxWidth = ref[0], maxHeight = ref[1];
ref = _this.prepareFrames(view), maxWidth = ref[0], maxHeight = ref[1]; $swipeFrame = $('.swipe-frame', view);
$swipeFrame = $('.swipe-frame', view); $swipeWrap = $('.swipe-wrap', view);
$swipeWrap = $('.swipe-wrap', view); $swipeBar = $('.swipe-bar', view);
$swipeBar = $('.swipe-bar', view);
$swipeFrame.css({
$swipeFrame.css({ width: maxWidth + 16,
width: maxWidth + 16, height: maxHeight + 28
height: maxHeight + 28 });
}); $swipeWrap.css({
$swipeWrap.css({ width: maxWidth + 1,
width: maxWidth + 1, height: maxHeight + 2
height: maxHeight + 2 });
}); // Set swipeBar left position to match image frame
// Set swipeBar left position to match image frame $swipeBar.css({
$swipeBar.css({ left: 1
left: 1 });
});
wrapPadding = parseInt($swipeWrap.css('right').replace('px', ''), 10);
wrapPadding = parseInt($swipeWrap.css('right').replace('px', ''), 10);
_this.initDraggable($swipeBar, wrapPadding, function(e, left) {
_this.initDraggable($swipeBar, wrapPadding, function(e, left) { if (left > 0 && left < $swipeFrame.width() - (wrapPadding * 2)) {
if (left > 0 && left < $swipeFrame.width() - (wrapPadding * 2)) { $swipeWrap.width((maxWidth + 1) - left);
$swipeWrap.width((maxWidth + 1) - left); $swipeBar.css('left', left);
$swipeBar.css('left', left); }
} });
}); };
}; })(this));
})(this)); },
}, 'onion-skin': function() {
'onion-skin': function() { var dragTrackWidth, maxHeight, maxWidth;
var dragTrackWidth, maxHeight, maxWidth; maxWidth = 0;
maxWidth = 0; maxHeight = 0;
maxHeight = 0; dragTrackWidth = $('.drag-track', this.file).width() - $('.dragger', this.file).width();
dragTrackWidth = $('.drag-track', this.file).width() - $('.dragger', this.file).width(); return $('.onion-skin.view', this.file).each((function(_this) {
return $('.onion-skin.view', this.file).each((function(_this) { return function(index, view) {
return function(index, view) { var $frame, $track, $dragger, $frameAdded, framePadding, ref, dragging = false;
var $frame, $track, $dragger, $frameAdded, framePadding, ref, dragging = false; ref = _this.prepareFrames(view), maxWidth = ref[0], maxHeight = ref[1];
ref = _this.prepareFrames(view), maxWidth = ref[0], maxHeight = ref[1]; $frame = $('.onion-skin-frame', view);
$frame = $('.onion-skin-frame', view); $frameAdded = $('.frame.added', view);
$frameAdded = $('.frame.added', view); $track = $('.drag-track', view);
$track = $('.drag-track', view); $dragger = $('.dragger', $track);
$dragger = $('.dragger', $track);
$frame.css({
$frame.css({ width: maxWidth + 16,
width: maxWidth + 16, height: maxHeight + 28
height: maxHeight + 28 });
}); $('.swipe-wrap', view).css({
$('.swipe-wrap', view).css({ width: maxWidth + 1,
width: maxWidth + 1, height: maxHeight + 2
height: maxHeight + 2 });
}); $dragger.css({
$dragger.css({ left: dragTrackWidth
left: dragTrackWidth });
});
$frameAdded.css('opacity', 1);
$frameAdded.css('opacity', 1); framePadding = parseInt($frameAdded.css('right').replace('px', ''), 10);
framePadding = parseInt($frameAdded.css('right').replace('px', ''), 10);
_this.initDraggable($dragger, framePadding, function(e, left) {
_this.initDraggable($dragger, framePadding, function(e, left) { var opacity = left / dragTrackWidth;
var opacity = left / dragTrackWidth;
if (opacity >= 0 && opacity <= 1) {
if (opacity >= 0 && opacity <= 1) { $dragger.css('left', left);
$dragger.css('left', left); $frameAdded.css('opacity', opacity);
$frameAdded.css('opacity', opacity); }
} });
}); };
}; })(this));
})(this)); }
}
};
} }
requestImageInfo(img, callback) { requestImageInfo(img, callback) {
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<div <div
:id="id" :id="id"
class="modal" class="modal"
:class="id !== '' ? '' : 'show'" :class="id === '' ? '' : 'show'"
role="dialog" role="dialog"
tabindex="-1" tabindex="-1"
> >
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
</div> </div>
</div> </div>
<div <div
v-if="id !== ''" v-if="id === ''"
class="modal-backdrop fade in" class="modal-backdrop fade in"
> >
</div> </div>
......
...@@ -2419,9 +2419,9 @@ eslint-visitor-keys@^1.0.0: ...@@ -2419,9 +2419,9 @@ eslint-visitor-keys@^1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
eslint@3.18.0: eslint@^3.18.0:
version "3.18.0" version "3.19.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc"
dependencies: dependencies:
babel-code-frame "^6.16.0" babel-code-frame "^6.16.0"
chalk "^1.1.3" chalk "^1.1.3"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment