Merge "Moving inline html code out of transfer-table.spec.js"
This commit is contained in:
commit
3369e93497
@ -0,0 +1,40 @@
|
|||||||
|
<transfer-table tr-model="tableData">
|
||||||
|
<allocated>
|
||||||
|
<table st-table="tableData.displayedAllocated" st-safe-src="tableData.allocated" hz-table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Animal</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="alRow in tableData.displayedAllocated">
|
||||||
|
<td>{$ alRow.animal $}</td>
|
||||||
|
<td>
|
||||||
|
<action-list>
|
||||||
|
<action callback="trCtrl.deallocate" item="alRow"></action>
|
||||||
|
</action-list>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</allocated>
|
||||||
|
<available>
|
||||||
|
<table st-table="tableData.available" hz-table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Animal</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="row in tableData.available" ng-if="!trCtrl.allocatedIds[row.id]">
|
||||||
|
<td>{$ row.animal $}</td>
|
||||||
|
<td>
|
||||||
|
<action-list>
|
||||||
|
<action callback="trCtrl.allocate" item="row"></action>
|
||||||
|
</action-list>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</available>
|
||||||
|
</transfer-table>
|
@ -0,0 +1,40 @@
|
|||||||
|
<transfer-table tr-model="tableData" limits="limits">
|
||||||
|
<available>
|
||||||
|
<table st-table="tableData.available" hz-table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Animal</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="row in tableData.available" ng-if="!trCtrl.allocatedIds[row.id]">
|
||||||
|
<td>{$ row.animal $}</td>
|
||||||
|
<td>
|
||||||
|
<action-list>
|
||||||
|
<action callback="trCtrl.allocate" item="row">x</action>
|
||||||
|
</action-list>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</available>
|
||||||
|
<allocated>
|
||||||
|
<table st-table="tableData.allocated" hz-table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Animal</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="alRow in tableData.allocated">
|
||||||
|
<td>{$ alRow.animal $}</td>
|
||||||
|
<td>
|
||||||
|
<action-list>
|
||||||
|
<action callback="trCtrl.deallocate" item="alRow">x</action>
|
||||||
|
</action-list>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</allocated>
|
||||||
|
</transfer-table>
|
@ -29,14 +29,12 @@
|
|||||||
beforeEach(module('templates'));
|
beforeEach(module('templates'));
|
||||||
beforeEach(module('smart-table'));
|
beforeEach(module('smart-table'));
|
||||||
beforeEach(module('horizon.framework'));
|
beforeEach(module('horizon.framework'));
|
||||||
beforeEach(module('horizon.framework.widgets'));
|
|
||||||
beforeEach(module('horizon.framework.widgets.action-list'));
|
|
||||||
beforeEach(module('horizon.framework.widgets.table'));
|
|
||||||
beforeEach(module('horizon.framework.widgets.transfer-table'));
|
|
||||||
|
|
||||||
describe('max 1 allocation', function() {
|
describe('max 1 allocation', function() {
|
||||||
|
|
||||||
beforeEach(inject(function($injector) {
|
beforeEach(inject(function($injector) {
|
||||||
|
var $templateCache = $injector.get('$templateCache');
|
||||||
|
var basePath = $injector.get('horizon.framework.widgets.basePath');
|
||||||
var $compile = $injector.get('$compile');
|
var $compile = $injector.get('$compile');
|
||||||
$scope = $injector.get('$rootScope').$new();
|
$scope = $injector.get('$rootScope').$new();
|
||||||
$timeout = $injector.get('$timeout');
|
$timeout = $injector.get('$timeout');
|
||||||
@ -54,35 +52,7 @@
|
|||||||
displayedAllocated: []
|
displayedAllocated: []
|
||||||
};
|
};
|
||||||
|
|
||||||
/*eslint-disable max-len */
|
var markup = $templateCache.get(basePath + 'transfer-table/transfer-table.max-1.mock.html');
|
||||||
var markup = '<transfer-table tr-model="tableData">' +
|
|
||||||
'<allocated>' +
|
|
||||||
'<table st-table="tableData.displayedAllocated" st-safe-src="tableData.allocated" hz-table>' +
|
|
||||||
'<thead><tr><th>Animal</th></tr></thead>' +
|
|
||||||
'<tbody><tr ng-repeat="alRow in tableData.displayedAllocated">' +
|
|
||||||
'<td>{$ alRow.animal $}</td>' +
|
|
||||||
'<td><action-list>' +
|
|
||||||
' <action callback="trCtrl.deallocate" item="alRow">x' +
|
|
||||||
' </action>' +
|
|
||||||
'</action-list></td>' +
|
|
||||||
'</tr></tbody>' +
|
|
||||||
'</table>' +
|
|
||||||
'</allocated>' +
|
|
||||||
'<available>' +
|
|
||||||
'<table st-table="tableData.available" hz-table>' +
|
|
||||||
'<thead><tr><th>Animal</th></tr></thead>' +
|
|
||||||
'<tbody><tr ng-repeat="row in tableData.available" ng-if="!trCtrl.allocatedIds[row.id]">' +
|
|
||||||
'<td>{$ row.animal $}</td>' +
|
|
||||||
'<td><action-list>' +
|
|
||||||
' <action callback="trCtrl.allocate" item="row">x' +
|
|
||||||
' </action>' +
|
|
||||||
'</action-list></td>' +
|
|
||||||
'</tr></tbody>' +
|
|
||||||
'</table>' +
|
|
||||||
'</available>' +
|
|
||||||
'</transfer-table>';
|
|
||||||
/*eslint-enable max-len */
|
|
||||||
|
|
||||||
$element = angular.element(markup);
|
$element = angular.element(markup);
|
||||||
$compile($element)($scope);
|
$compile($element)($scope);
|
||||||
|
|
||||||
@ -133,6 +103,8 @@
|
|||||||
describe('max 2 allocations', function() {
|
describe('max 2 allocations', function() {
|
||||||
|
|
||||||
beforeEach(inject(function($injector) {
|
beforeEach(inject(function($injector) {
|
||||||
|
var $templateCache = $injector.get('$templateCache');
|
||||||
|
var basePath = $injector.get('horizon.framework.widgets.basePath');
|
||||||
var $compile = $injector.get('$compile');
|
var $compile = $injector.get('$compile');
|
||||||
$scope = $injector.get('$rootScope').$new();
|
$scope = $injector.get('$rootScope').$new();
|
||||||
|
|
||||||
@ -153,34 +125,7 @@
|
|||||||
maxAllocation: 2
|
maxAllocation: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/*eslint-disable max-len */
|
var markup = $templateCache.get(basePath + 'transfer-table/transfer-table.max-2.mock.html');
|
||||||
var markup = '<transfer-table tr-model="tableData" limits="limits">' +
|
|
||||||
'<available>' +
|
|
||||||
'<table st-table="tableData.available" hz-table>' +
|
|
||||||
'<thead><tr><th>Animal</th></tr></thead>' +
|
|
||||||
'<tbody><tr ng-repeat="row in tableData.available" ng-if="!trCtrl.allocatedIds[row.id]">' +
|
|
||||||
'<td>{$ row.animal $}</td>' +
|
|
||||||
'<td><action-list>' +
|
|
||||||
' <action callback="trCtrl.allocate" item="row">x' +
|
|
||||||
' </action>' +
|
|
||||||
'</action-list></td>' +
|
|
||||||
'</tr></tbody>' +
|
|
||||||
'</table>' +
|
|
||||||
'</available>' +
|
|
||||||
'<allocated>' +
|
|
||||||
'<table st-table="tableData.allocated" hz-table>' +
|
|
||||||
'<thead><tr><th>Animal</th></tr></thead>' +
|
|
||||||
'<tbody><tr ng-repeat="alRow in tableData.allocated">' +
|
|
||||||
'<td>{$ alRow.animal $}</td>' +
|
|
||||||
'<td><action-list>' +
|
|
||||||
' <action callback="trCtrl.deallocate" item="alRow">x' +
|
|
||||||
' </action>' +
|
|
||||||
'</action-list></td>' +
|
|
||||||
'</tr></tbody>' +
|
|
||||||
'</table>' +
|
|
||||||
'</allocated>' +
|
|
||||||
'</transfer-table>';
|
|
||||||
/*eslint-enable max-len */
|
|
||||||
|
|
||||||
$element = angular.element(markup);
|
$element = angular.element(markup);
|
||||||
$compile($element)($scope);
|
$compile($element)($scope);
|
||||||
|
Loading…
Reference in New Issue
Block a user