Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(flicking): Fix wrong referencing of panel elements #457

Merged
merged 2 commits into from
Mar 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/flicking.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ eg.module("flicking", ["jQuery", eg, window, document, eg.MovableCoord], functio
_setConfig: function($children, _prefix) {
var options = this.options;
var padding = options.previewPadding;
var $container = $children.filter("." + options.prefix + "-container:first");

if ($children.eq(0).hasClass(options.prefix + "-container")) {
this.$container = $children;
$children = $children.children();
if ($container.length) {
this.$container = $container;
$children = $container.children();
}

// config value
Expand Down
5 changes: 5 additions & 0 deletions test/unit/flicking.test.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ <h2 id="qunit-userAgent"></h2>
<p>Layer 2</p>
</div>
</div>
<div class="spot_cont_box">
<div class="item_source"></div>
<div class="item_source"></div>
<div class="item_source"></div>
</div>
</div>

Circular :
Expand Down
2 changes: 2 additions & 0 deletions test/unit/js/flicking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ QUnit.test("Check for the initialization", function(assert) {

// https://github.com/naver/egjs/issues/216
var $container = $("#mflick1-1 > :first-child").attr("id", "container");
var panelCount = $container.children().size();
var inst3 = this.create("#mflick1-1");

// Then
Expand All @@ -100,6 +101,7 @@ QUnit.test("Check for the initialization", function(assert) {
assert.equal(inst2._conf.panel.size, inst2._conf.panel.$list.outerHeight(), "The panel should maintain same height as wrapper element.");

assert.equal($container.attr("id"), inst3.$container.attr("id"), "The given DOM is used as container element?");
assert.equal(panelCount, inst3._conf.panel.$list.length, "The panels are taken properly referenced?");
});

QUnit.module("Setting options", hooks);
Expand Down