Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'issue-1069-selectlist-display-none' of https://github.c…
Browse files Browse the repository at this point in the history
…om/cormacmccarthy/fuelux into issue-1069-selectlist-display-none
  • Loading branch information
BenjaminNeilDavis committed Feb 11, 2015
2 parents 75b05bf + 2fc0e22 commit bb2bc0c
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 26 deletions.
9 changes: 6 additions & 3 deletions dist/css/fuelux.css

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

2 changes: 1 addition & 1 deletion dist/css/fuelux.css.map

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions dist/css/fuelux.min.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Fuel UX EDGE - Built 2015/02/10, 3:42:38 PM
* Fuel UX EDGE - Built 2015/02/11, 3:17:17 PM
* Previous release: v3.5.1
* Copyright 2012-2015 ExactTarget
* Licensed under the BSD-3-Clause license (https://github.com/ExactTarget/fuelux/blob/master/LICENSE)
Expand All @@ -8,7 +8,6 @@
@charset "UTF-8";
.fuelux {
/* TODO use bs base variables if possible */
/*# sourceMappingURL=fuelux.css.map */
}
.fuelux .clearfix {
*zoom: 1;
Expand Down Expand Up @@ -610,6 +609,10 @@
top: 0;
float: left;
}
.fuelux .button-sizer .selectlist,
.fuelux .selectlist-sizer .selectlist {
display: block !important;
}
.fuelux .button-sizer .dropdown-menu,
.fuelux .selectlist-sizer .dropdown-menu {
display: block;
Expand Down Expand Up @@ -2085,4 +2088,3 @@ END
padding: 0;
text-shadow: 0 1px #fff;
}
/*# sourceMappingURL=fuelux.css.map */
Binary file modified dist/fuelux.zip
Binary file not shown.
30 changes: 17 additions & 13 deletions dist/js/fuelux.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Fuel UX EDGE - Built 2015/02/10, 3:42:38 PM
* Fuel UX EDGE - Built 2015/02/11, 3:17:17 PM
* Previous release: v3.5.1
* Copyright 2012-2015 ExactTarget
* Licensed under the BSD-3-Clause license (https://github.com/ExactTarget/fuelux/blob/master/LICENSE)
Expand Down Expand Up @@ -2297,7 +2297,7 @@
( function( $ ) {

/*
* Fuel UX Button Dropdown
* Fuel UX Selectlist
* https://github.com/ExactTarget/fuelux
*
* Copyright (c) 2014 ExactTarget
Expand Down Expand Up @@ -2410,6 +2410,10 @@
}
} );

if ( width <= 1 ) {
return;
}

this.$button.css( 'width', width );
this.$dropdownMenu.css( 'width', width );

Expand Down Expand Up @@ -5644,7 +5648,7 @@
return false;
},
renderItem: function( helpers ) {
renderRow.call( this, helpers.container, helpers.data, helpers.subset, helpers.index );
renderRow.call( this, helpers.container, helpers.subset, helpers.index );
return false;
},
after: function() {
Expand All @@ -5666,11 +5670,11 @@
}

//ADDITIONAL METHODS
function renderColumn( $row, data, rowIndex, columns, index ) {
var className = columns[ index ].className;
var content = data.items[ rowIndex ][ columns[ index ].property ];
function renderColumn( $row, rows, rowIndex, columns, columnIndex ) {
var className = columns[ columnIndex ].className;
var content = rows[ rowIndex ][ columns[ columnIndex ].property ];
var $col = $( '<td></td>' );
var width = columns[ index ]._auto_width;
var width = columns[ columnIndex ]._auto_width;

$col.addClass( ( ( className !== undefined ) ? className : '' ) ).append( content );
if ( width !== undefined ) {
Expand All @@ -5681,9 +5685,9 @@
if ( this.viewOptions.list_columnRendered ) {
this.viewOptions.list_columnRendered( {
container: $row,
columnAttr: columns[ index ].property,
columnAttr: columns[ columnIndex ].property,
item: $col,
rowData: data.items[ rowIndex ]
rowData: rows[ rowIndex ]
}, function() {} );
}
}
Expand Down Expand Up @@ -5763,15 +5767,15 @@
$tr.append( $header );
}

function renderRow( $tbody, data, subset, index ) {
function renderRow( $tbody, rows, index ) {
var $row = $( '<tr></tr>' );
var self = this;
var i, l;

if ( this.viewOptions.list_selectable ) {
$row.addClass( 'selectable' );
$row.attr( 'tabindex', 0 ); // allow items to be tabbed to / focused on
$row.data( 'item_data', subset[ index ] );
$row.data( 'item_data', rows[ index ] );
$row.on( 'click.fu.repeaterList', function() {
var $item = $( this );
if ( $item.hasClass( 'selected' ) ) {
Expand Down Expand Up @@ -5804,14 +5808,14 @@
$tbody.append( $row );

for ( i = 0, l = this.list_columns.length; i < l; i++ ) {
renderColumn.call( this, $row, data, index, this.list_columns, i );
renderColumn.call( this, $row, rows, index, this.list_columns, i );
}

if ( this.viewOptions.list_rowRendered ) {
this.viewOptions.list_rowRendered( {
container: $tbody,
item: $row,
rowData: data
rowData: rows[ index ]
}, function() {} );
}
}
Expand Down
6 changes: 3 additions & 3 deletions dist/js/fuelux.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion less/selectlist.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
.btn.dropdown-toggle {
text-align: left;
padding-right: 2 * @selectlist-horizontal-padding + @selectlist-caret-width;
padding-right: unit((2 * @selectlist-horizontal-padding + @selectlist-caret-width), px);

.caret {
.vertical-align();
Expand Down
2 changes: 1 addition & 1 deletion test/fuelux-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ define(function(require){
var $ = require('jquery');

QUnit.start(); // starting qunit, or phantom js will have a problem

// Needed for saucelab testing
var log = [];
var testName;
Expand Down
5 changes: 4 additions & 1 deletion test/fuelux.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<title>Fuel UX Test Suite</title>

<link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css" media="screen">
<link href="../bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="../dist/css/fuelux.css" rel="stylesheet" type="text/css">


<script src="../bower_components/moment/min/moment-with-locales.js"></script>
<script src="../bower_components/qunit/qunit/qunit.js"></script>
Expand Down Expand Up @@ -61,7 +64,7 @@
})();
</script>
</head>
<body>
<body class="fuelux">
<h1 id="qunit-header">Fuel UX Test Suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
Expand Down
17 changes: 17 additions & 0 deletions test/selectlist-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ define(function(require){
//var html = require('text!dev.html!strip');
html = $('<div>'+html+'</div>');

$('body').append(html);

require('bootstrap');
require('fuelux/selectlist');

Expand All @@ -23,6 +25,21 @@ define(function(require){
ok($selectlist.selectlist() === $selectlist, 'selectlist should be initialized');
});

test("should autosize correctly", function () {
var $selectlist8 = $('body').find('#MySelectlist8').selectlist();
var $selectlist9 = $('body').find('#MySelectlist9').selectlist();

// stop();
// setTimeout(function() {
ok(($selectlist8.width() >= 147 && $selectlist8.width() <= 152), 'selectlist autoresized');
ok($selectlist9.width() === 0, 'selectlist hidden, sized 0');

$selectlist9.removeClass('hidden');
ok(($selectlist9.width() >= 147 && $selectlist9.width() <= 152), 'selectlist was hidden, now shown, sized 149');
// start();
// }, 1000);
});

test("should set disabled state", function () {
var $selectlist = $(html).find('#MySelectlist').selectlist();
$selectlist.selectlist('disable');
Expand Down

0 comments on commit bb2bc0c

Please sign in to comment.