Skip to content

Commit 9a5e573

Browse files
committed
Merge branch 'master' into interpolation
2 parents ede4e3f + f62856d commit 9a5e573

10 files changed

+47
-12
lines changed

dist/ui-scroll-grid.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-scroll-grid.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-scroll-grid.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-scroll-grid.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-scroll.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-scroll.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-scroll.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ui-scroll-grid.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ angular.module('ui.scroll.grid', [])
183183
return; // throw an error?
184184
}
185185

186-
let mapTo = selected.mapTo, next = null;
186+
let mapTo = selected.mapTo,
187+
next = null;
187188
index -= mapTo < index ? 1 : 0;
188189

189190
columns.forEach(c => {

test/GridTestsSpec.js

+26
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,30 @@ describe('uiScroll', function () {
399399

400400
});
401401

402+
describe('scopes wrapping', function () {
403+
var scrollSettings = {
404+
datasource: 'myGridDatasource',
405+
viewportHeight: 120,
406+
itemHeight: 20,
407+
bufferSize: 3,
408+
rowTemplate: '<td ng-repeat="col in columns" ui-scroll-td class="{{col}}">{{item[col]}}</td>'
409+
};
410+
var columns = ['col0', 'col1', 'col2', 'col3'];
411+
412+
it('should work', function () {
413+
runGridTest(scrollSettings,
414+
function(head, body) {
415+
for(var i = 0; i < columns.length; i++) {
416+
expect(getLastRowElement(body, i).innerHTML).toBe(columns[i]);
417+
}
418+
},
419+
{
420+
scope: {
421+
columns: columns
422+
}
423+
}
424+
);
425+
});
426+
});
427+
402428
});

test/scaffolding.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ function createGridHtml (settings) {
2525
'<thead style="display:block">' +
2626
'<tr>';
2727
columns.forEach(col => { html +=
28-
'<th ui-scroll-th class="' + col + '">' + col + '</th>'
28+
'<th ui-scroll-th class="' + col + '">' + col + '</th>';
2929
}); html +=
3030
'</tr>' +
3131
'</thead>' +
3232
'<tbody class="grid">' +
3333
'<tr ui-scroll="item in ' + settings.datasource + '" adapter="adapter">';
34-
columns.forEach(col => { html +=
35-
'<td ui-scroll-td class="' + col + '">{{item.' + col + '}}</td>'
36-
}); html +=
34+
if(settings.rowTemplate) {
35+
html += settings.rowTemplate;
36+
} else {
37+
columns.forEach(col => { html +=
38+
'<td ui-scroll-td class="' + col + '">{{item.' + col + '}}</td>';
39+
});
40+
} html +=
3741
'</tr>' +
3842
'</tbody>' +
3943
'</table>';
@@ -83,6 +87,10 @@ function runGridTest (scrollSettings, run, options) {
8387
var head = angular.element(scroller.children()[0]);
8488
var body = angular.element(scroller.children()[1]);
8589

90+
if(options && options.scope) {
91+
angular.extend(scope, options.scope);
92+
}
93+
8694
$compile(scroller)(scope);
8795

8896
scope.$apply();

0 commit comments

Comments
 (0)