Skip to content

Commit e8a973f

Browse files
author
Scott Jehl
committed
Merge pull request jquery-archive#1710 from gseguin/issue-1338
Issue 1338
2 parents b3ad908 + 17000df commit e8a973f

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

tests/unit/select/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ <h2 id="qunit-userAgent"></h2>
239239
<option value="overnight">Overnight</option>
240240
</select>
241241
</div>
242+
243+
<div data-nstest-role="fieldcontain" id="select-long-option-label-container">
244+
<select name="select-long-option-label" id="select-long-option-label">
245+
<option value="short">Choice 1</option>
246+
<option value="long">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</option>
247+
</select>
248+
</div>
242249
</div>
243250
</body>
244251
</html>

tests/unit/select/select_core.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,33 @@
9595
$.testHelper.sequence(sequence, 1000);
9696
});
9797

98+
module("Non native menus", {
99+
setup: function() {
100+
$.mobile.selectmenu.prototype.options.nativeMenu = false;
101+
},
102+
teardown: function() {
103+
$.mobile.selectmenu.prototype.options.nativeMenu = true;
104+
}
105+
});
106+
107+
asyncTest( "a large select option should not overflow", function(){
108+
// https://github.com/jquery/jquery-mobile/issues/1338
109+
var menu, select = $("#select-long-option-label");
110+
111+
$.testHelper.sequence([
112+
function(){
113+
// bring up the dialog
114+
select.trigger("click");
115+
},
116+
117+
function() {
118+
menu = $(".ui-selectmenu-list");
119+
120+
equal(menu.width(), menu.find("li:nth-child(2) .ui-btn-text").width(), "ui-btn-text element should not overflow")
121+
start();
122+
}
123+
], 500);
124+
125+
});
126+
98127
})(jQuery);

themes/default/jquery.mobile.forms.select.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
label.ui-select { font-size: 16px; line-height: 1.4; font-weight: normal; margin: 0 0 .3em; display: block; }
1818

1919
/*listbox*/
20-
.ui-select .ui-btn-text, .ui-selectmenu .ui-btn-text { display: inline-block; min-height: 1em; }
21-
.ui-select .ui-btn-text { text-overflow: ellipsis; overflow: hidden; display: block;}
20+
.ui-select .ui-btn-text, .ui-selectmenu .ui-btn-text { display: block; min-height: 1em; }
21+
.ui-select .ui-btn-text { text-overflow: ellipsis; overflow: hidden;}
2222

2323
.ui-selectmenu { position: absolute; padding: 0; z-index: 100 !important; width: 80%; max-width: 350px; padding: 6px; }
2424
.ui-selectmenu .ui-listview { margin: 0; }

0 commit comments

Comments
 (0)