Browse Source

get sort data test

title
pull/563/head
David DeSandro 12 years ago
parent
commit
d074425e44
  1. 2
      notes.md
  2. 3
      test/.jshintrc
  3. 22
      test/get-sort-data.js
  4. 12
      test/index.html
  5. 38
      test/tests.css

2
notes.md

@ -2,8 +2,6 @@
## tests
getSortData shorthand
filter
updateSortData

3
test/.jshintrc

@ -5,8 +5,7 @@
"undef": true,
"unused": true,
"predef": {
"Masonry": false,
"checkItemPositions": false,
"Isotope": false,
"asyncTest": false,
"deepEqual": false,

22
test/get-sort-data.js

@ -0,0 +1,22 @@
test( 'getSortData', function() {
'use strict';
var iso = new Isotope( '#get-sort-data', {
layoutMode: 'fitRows',
getSortData: {
ninjaTurtle: '[data-ninja-turtle]',
fruit: 'span.fruit',
b: 'b parseFloat',
i: 'i parseInt'
}
});
var item = iso.items[0];
equal( item.sortData.ninjaTurtle, 'leonardo', '[data-attr] shorthand' );
equal( item.sortData.fruit, 'watermelon', 'query selector shorthand' );
equal( item.sortData.b, 3.14, 'parseFloat parser' );
equal( item.sortData.i, 42, 'parseInt parser' );
});

12
test/index.html

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Masonry tests</title>
<title>Isotope tests</title>
<link rel="stylesheet" href="tests.css" />
<link rel="stylesheet" href="../bower_components/qunit/qunit/qunit.css" />
@ -28,6 +28,7 @@
<script src="../layout-modes/masonry.js"></script>
<script src="sorting.js"></script>
<script src="get-sort-data.js"></script>
</head>
<body>
@ -48,6 +49,15 @@
<div class="item"><b>A</b><i>2</i></div>
</div>
<h2>getSortData</h2>
<div id="get-sort-data" class="container">
<div class="item" data-ninja-turtle="leonardo">
<span class="fruit">watermelon</span>
<b>3.14</b>
<i>42</i>
</div>
</div>
</body>
</html>

38
test/tests.css

@ -15,12 +15,18 @@ body {
position: relative;
}
.container:after {
content: '';
display: block;
clear: both;
}
.item {
width: 60px;
height: 30px;
float: left;
border: 1px solid;
background: #09F;
background: #3BF;
}
.item.w2 { width: 120px; }
@ -38,15 +44,6 @@ body {
border: 1px solid;
}
/* ---- gutter ---- */
#gutter {
width: 220px;
}
#gutter .item.w2 { width: 140px; }
/* ---- stamp ---- */
.has-stamp .item { width: 45px; }
@ -62,24 +59,3 @@ body {
width: 200px;
height: 20px;
}
#stamp-top-left .stamp1 {
left: 70px;
top: 10px;
}
#stamp-top-left .stamp2 {
left: -5px;
top: 0;
}
#stamp-bottom-right .stamp1 {
right: 70px;
bottom: 10px;
}
#stamp-bottom-right .stamp2 {
right: -5px;
bottom: 0;
}

Loading…
Cancel
Save