Skip to content

Commit

Permalink
Merge pull request #14838 from CartoDB/14832-selecting-title
Browse files Browse the repository at this point in the history
Replace title when selecting visualizations
  • Loading branch information
Alejandra Arri authored May 6, 2019
2 parents 0842624 + 682493e commit 75f5691
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Development
* Fix trial expired message without expiration date ([CartoDB/support#1997](https://github.com/CartoDB/support/issues/1997))
* Obfuscate password in connector content ([CartoDB/support#2013](https://github.com/CartoDB/support/issues/2013))
* Remove Editor dashboard from cartodb folder ([#14796](https://github.com/CartoDB/cartodb/pull/14796))
* Replace title for items number when selecting visualizations ([#14832](https://github.com/CartoDB/cartodb/issues/14832))

4.26.0 (2019-03-11)
-------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ export default {
return this.$store.getters['user/canCreateDatasets'];
},
pageTitle () {
return this.$t(`DataPage.header.title['${this.appliedFilter}']`);
return this.selectedDatasets.length
? this.$t('BulkActions.selected', {count: this.selectedDatasets.length})
: this.$t(`DataPage.header.title['${this.appliedFilter}']`);
},
areAllDatasetsSelected () {
return Object.keys(this.datasets).length === this.selectedDatasets.length;
Expand Down
4 changes: 3 additions & 1 deletion lib/assets/javascripts/new-dashboard/components/MapsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ export default {
isFirstTimeViewingDashboard: state => state.config.isFirstTimeViewingDashboard
}),
pageTitle () {
return this.$t(`MapsPage.header.title['${this.appliedFilter}']`);
return this.selectedMaps.length
? this.$t('BulkActions.selected', {count: this.selectedMaps.length})
: this.$t(`MapsPage.header.title['${this.appliedFilter}']`);
},
areAllMapsSelected () {
return Object.keys(this.maps).length === this.selectedMaps.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ describe('DatasetsList.vue', () => {
expect(datasetsList).toMatchSnapshot();
});

it('should replace title for items number when selecting datasets', () => {
const store = createStore();
const propsData = {
asBulkActions: true,
canHoverCard: true
};
const datasetsList = createDatasetsList(store, propsData);

expect(datasetsList.vm.pageTitle).toBe(`DataPage.header.title['mine']`);

const dataset = datasets.visualizations[0];
datasetsList.setData({
selectedDatasets: [dataset]
});

expect(datasetsList.vm.pageTitle).toBe('BulkActions.selected');
});

describe('Methods', () => {
it('applyOrder: should dispatch datasets/order with order options', () => {
const store = createStore();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@ describe('MapsList.vue', () => {
expect(mapsList).toMatchSnapshot();
});

it('should replace title for items number when selecting maps', () => {
const store = createStore();
const propsData = {
hasBulkActions: true,
canHoverCard: true,
canChangeViewMode: false,
isCondensedDefault: true,
showViewAll: true
};
const mapsList = createMapsList(store, propsData);

expect(mapsList.vm.pageTitle).toBe(`MapsPage.header.title['mine']`);

const map = maps.visualizations[0];
mapsList.setData({
selectedMaps: [map]
});

expect(mapsList.vm.pageTitle).toBe('BulkActions.selected');
});

describe('Methods', () => {
it('applyOrder: should dispatch maps/order with order options', () => {
const store = createStore();
Expand Down

0 comments on commit 75f5691

Please sign in to comment.