Skip to content

Commit

Permalink
fix ICL-1537 属性表无法接入iserver 地图服务 review by luox
Browse files Browse the repository at this point in the history
  • Loading branch information
xilanhuaweidapao committed May 21, 2024
1 parent b16742b commit 8aae9e0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mapboxgl/attributes/AttributesViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ class FeatureTableViewModel extends mapboxgl.Evented {
}

canLazyLoad() {
return this.lazy && this.dataset && this.dataset.url && this.dataset.type === 'iServer';
return !!(this.lazy && this.dataset && this.dataset.url && this.dataset.type === 'iServer' && this.dataset.dataName);
}

handleAssociateWithMap() {
Expand Down
25 changes: 23 additions & 2 deletions src/mapboxgl/attributes/__tests__/AttributesViewModel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,27 @@ describe('AttributesViewModel.ts', () => {
expect(viewModel.lazy).toBe(true);
});

it('check restmap not support lazy', async () => {
const nextOption = {
...options,
dataset: {
layerName: 'Rivers@World',
type: 'iServer',
url: 'http://test'
},
lazy: true,
searchText: '漠河',
searchedColumn: '站台',
sorter: {
field: '温度',
order: 'ascend'
}
};
const viewModel = new AttributesViewModel(nextOption);
await flushPromises();
expect(viewModel.canLazyLoad()).toBe(false);
});

it('setsorter', () => {
const viewModel = new AttributesViewModel(options);
const sorter = () => jest.fn();
Expand Down Expand Up @@ -491,9 +512,9 @@ describe('AttributesViewModel.ts', () => {
const viewModel = new AttributesViewModel(options);
const columns = viewModel.toTableColumns(headers);
columns.forEach((element, index) => {
if([1, 2, 8].includes(index)){
if ([1, 2, 8].includes(index)) {
expect(typeof element.sorter).toBe('function');
}else {
} else {
expect(element.sorter).toBe(undefined);
}
});
Expand Down

0 comments on commit 8aae9e0

Please sign in to comment.