Skip to content

Commit 01e1124

Browse files
RomakitaTravismarqbeniamin
authored
fix(MdDatepicker): Pick text button (confirm and cancel) from locale configuration (#2078)
* fix(MdDatepicker): Pick text button (confirm and cancel) from locale * fix(jest): Add jest-localstorage-mock to fix unit test issue Co-authored-by: Travis <rom.lenzotti@zenika.com> Co-authored-by: Marcu Beniamin <marqbeniamin@yahoo.com>
1 parent 7941614 commit 01e1124

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

docs/app/pages/Configuration.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@
6262
shorterMonths: ['J', 'F', 'M', 'A', 'M', 'Ju', 'Ju', 'A', 'Se', 'O', 'N', 'D'],
6363

6464
// `0` stand for Sunday, `1` stand for Monday
65-
firstDayOfAWeek: 0
65+
firstDayOfAWeek: 0,
66+
67+
cancel: 'Cancel',
68+
confirm: 'Ok'
6669
}
6770
}
6871
</code-example>

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"is-promise": "^2.1.0",
9797
"jest": "^22.4.4",
9898
"jest-vue": "^0.8.2",
99+
"jest-localstorage-mock": "^2.4.2",
99100
"node-sass": "^4.7.2",
100101
"offline-plugin": "^4.9.1",
101102
"optimize-css-assets-webpack-plugin": "^3.2.0",

src/components/MdDatepicker/MdDatepickerDialog.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
</div>
8080

8181
<md-dialog-actions class="md-datepicker-body-footer">
82-
<md-button class="md-primary" @click="onCancel">Cancel</md-button>
83-
<md-button v-if="!mdImmediately" class="md-primary" @click="onConfirm">Ok</md-button>
82+
<md-button class="md-primary" @click="onCancel">{{ locale.cancel }}</md-button>
83+
<md-button v-if="!mdImmediately" class="md-primary" @click="onConfirm">{{ locale.confirm }}</md-button>
8484
</md-dialog-actions>
8585
</div>
8686
</div>

src/material.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const init = () => {
1616
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
1717
shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'],
1818
shorterMonths: ['J', 'F', 'M', 'A', 'M', 'Ju', 'Ju', 'A', 'Se', 'O', 'N', 'D'],
19-
firstDayOfAWeek: 0
19+
firstDayOfAWeek: 0,
20+
cancel: 'Cancel',
21+
confirm: 'Ok'
2022
},
2123
router: {
2224
linkActiveClass: 'router-link-active'

test/setup.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'regenerator-runtime/runtime'
22
import Vue from 'vue'
33
import VueMaterial from 'src/material'
4+
import 'jest-localstorage-mock'
45

56
Vue.config.productionTip = false
67
Vue.config.devtools = false
@@ -26,4 +27,5 @@ function createAppEl () {
2627

2728
createAppEl()
2829

29-
process.on('unhandledRejection', () => {})
30+
process.on('unhandledRejection', () => {
31+
})

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -6108,6 +6108,11 @@ jest-leak-detector@^22.4.0:
61086108
dependencies:
61096109
pretty-format "^22.4.3"
61106110

6111+
jest-localstorage-mock@^2.4.2:
6112+
version "2.4.2"
6113+
resolved "https://registry.yarnpkg.com/jest-localstorage-mock/-/jest-localstorage-mock-2.4.2.tgz#31dd2916713eed3b8703196f60ec85ffd50c1a23"
6114+
integrity sha512-bywlhvs7RM2vpZ0EN12XOU5C2WAXRUbxl1VOxel4cqRUHD6zaUmh99UzwOTx0fWuqjfd0y/NDvEbewNaJaz+UQ==
6115+
61116116
jest-matcher-utils@^22.4.0, jest-matcher-utils@^22.4.3:
61126117
version "22.4.3"
61136118
resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-22.4.3.tgz#4632fe428ebc73ebc194d3c7b65d37b161f710ff"

0 commit comments

Comments
 (0)