diff --git a/test/e2e/index.js b/test/e2e/index.js index bf362d1e1..cb22c17c8 100644 --- a/test/e2e/index.js +++ b/test/e2e/index.js @@ -1,5 +1,6 @@ import Vue from 'vue' import plugin from '../../src/index' +import compare from '../../src/compare' Vue.use(plugin, { lang: 'en', @@ -21,8 +22,18 @@ Vue.use(plugin, { } }) -const translation = { - template: '
{{* $t("message.hello", "en", { name: "kazupon" })}}How are you?
' +const translation = {} + +if (compare(Vue.version, '2.0.0-alpha') < 0) { + translation.template = '{{* $t("message.hello", "en", { name: "kazupon" })}}How are you?
' +} else { + translation.render = function () { + return this.$createElement('p', { staticAttrs: { id: 'message' } }, [ + this.__toString__(this.$t('message.hello', 'en', { name: 'kazupon' })), + this.$createElement('br'), + 'How are you?' + ]) + } } new Vue(translation).$mount('#translation') diff --git a/test/specs/component.js b/test/specs/component.js index 158cedc68..1cd1c25f2 100644 --- a/test/specs/component.js +++ b/test/specs/component.js @@ -1,6 +1,7 @@ import assert from 'power-assert' import Vue from 'vue' import locales from './fixture/locales' +import compare from '../../src/compare' describe('component locales', () => { @@ -14,9 +15,8 @@ describe('component locales', () => { let vm beforeEach(done => { - vm = new Vue({ + const options = { el: document.createElement('div'), - template: '{{ $t("message.hello") }}
{{* $t("message.hoge") }}
' + } else { + compOptions.render = function () { + return this.$createElement('p', {}, [this.__toString__(this.$t('message.hoge'))]) + } + } + + const options = { el: () => { const el = document.createElement('div') - el.id = 'translate-parent' document.body.appendChild(el) return el }, - components: { - hoge: { - template: '{{* $t("message.hoge") }}
' - } + components: { hoge: compOptions } + } + + if (compare(Vue.version, '2.0.0-alpha') < 0) { + options.template = '{{ $t("message.hello") }}