lingui-react
Advanced tools
Comparing version 0.13.0-0 to 0.13.0-1
@@ -254,2 +254,3 @@ 'use strict'; | ||
var tagRe = /<(\d+)>(.*)<\/\1>|<(\d+)\/>/; | ||
var nlRe = /(?:\r\n|\r|\n)/g; | ||
@@ -269,3 +270,3 @@ /** | ||
var parts = value.split(tagRe); | ||
var parts = value.replace(nlRe, '').split(tagRe); | ||
@@ -272,0 +273,0 @@ // no inline elements, return |
{ | ||
"name": "lingui-react", | ||
"version": "0.13.0-0", | ||
"version": "0.13.0-1", | ||
"description": "React components for translations", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"module": "lib/index.es.js", | ||
"author": { | ||
@@ -37,4 +37,4 @@ "name": "Tomáš Ehrlich", | ||
"babel-runtime": "^6.23.0", | ||
"lingui-formats": "^0.4.0-0", | ||
"lingui-i18n": "^0.7.0-0", | ||
"lingui-formats": "^undefined", | ||
"lingui-i18n": "^undefined", | ||
"prop-types": "^15.5.10" | ||
@@ -41,0 +41,0 @@ }, |
@@ -6,2 +6,3 @@ // @flow | ||
const tagRe = /<(\d+)>(.*)<\/\1>|<(\d+)\/>/ | ||
const nlRe = /(?:\r\n|\r|\n)/g | ||
@@ -19,3 +20,3 @@ /** | ||
const parts = value.split(tagRe) | ||
const parts = value.replace(nlRe, '').split(tagRe) | ||
@@ -22,0 +23,0 @@ // no inline elements, return |
// @flow | ||
/* eslint-disable react/jsx-key */ | ||
import React from 'react' | ||
@@ -38,3 +39,3 @@ import { shallow } from 'enzyme' | ||
expect(html(formatElements( | ||
'Before <0>Inside <1>Nested</1> Between <2/> After</0>', | ||
'Before \n<0>Inside <1>\nNested</1>\n Between <2/> After</0>', | ||
[<a href="/about" />, <strong />, <br />] | ||
@@ -41,0 +42,0 @@ ))).toEqual(wrap('Before <a href="/about">Inside <strong>Nested</strong> Between <br/> After</a>')) |
@@ -7,2 +7,3 @@ // @flow | ||
import { I18nManager } from './I18nProvider' | ||
import { mockConsole } from './mocks' | ||
@@ -32,6 +33,6 @@ describe('I18nProvider', function () { | ||
it('should throw an error on incorrect language', function () { | ||
const component = () => mount(<I18nProvider language="xyz" messages={{}}> | ||
<div/> | ||
</I18nProvider>) | ||
expect(component).toThrowErrorMatchingSnapshot() | ||
mockConsole(console => { | ||
mount(<I18nProvider language="xyz" messages={{}}><div/></I18nProvider>) | ||
expect(console.warn).toBeCalledWith(expect.stringContaining('Unknown local')) | ||
}) | ||
}) | ||
@@ -98,6 +99,6 @@ | ||
i18nManager.update({ languageData: { fr: { plurals: 'Function' } } }) | ||
i18nManager.update({ languageData: { fr: { plurals: () => 'Function' } } }) | ||
expect(i18nManager.i18n.language).toEqual('fr') | ||
expect(i18nManager.i18n.messages).toEqual({ msg: 'salut!' }) | ||
expect(i18nManager.i18n.languageData).toEqual({ plurals: 'Function' }) | ||
expect(i18nManager.i18n.languageData.plurals()).toEqual('Function') | ||
}) | ||
@@ -104,0 +105,0 @@ |
@@ -6,2 +6,3 @@ // @flow | ||
import { InjectI18n } from '.' | ||
import { mockConsole } from './mocks' | ||
@@ -33,3 +34,4 @@ describe('InjectI18n [DEPRECATED]', function () { | ||
const { Sink, spy } = sinkFactory() | ||
const node = mount(<Sink {...props} />, { context: { i18nManager: customContext } }) | ||
const node = mount( | ||
<Sink {...props} />, { context: { i18nManager: customContext } }) | ||
const receivedProps = spy.mock.calls[spy.mock.calls.length - 1][0] | ||
@@ -47,34 +49,47 @@ | ||
it('should pass all props to wrapped component', function () { | ||
const props = { | ||
foo: 'bar', | ||
value: 1 | ||
} | ||
mockConsole(console => { | ||
const props = { | ||
foo: 'bar', | ||
value: 1 | ||
} | ||
// eslint-disable-next-line no-unused-vars | ||
const { i18n, ...calledProps } = mountHoc(props).props | ||
expect(calledProps).toEqual(props) | ||
// eslint-disable-next-line no-unused-vars | ||
const { i18n, ...calledProps } = mountHoc(props).props | ||
expect(calledProps).toEqual(props) | ||
expect(console.warn).toBeCalledWith(expect.stringContaining('DEPRECATED (removal in 1.x):')) | ||
}) | ||
}) | ||
it('should provide data from i18n context', function () { | ||
const { i18n } = mountHoc().props | ||
expect(i18n).toBeDefined() | ||
expect(i18n.language).toBeDefined() | ||
expect(i18n.messages).toBeDefined() | ||
mockConsole(console => { | ||
const { i18n } = mountHoc().props | ||
expect(i18n).toBeDefined() | ||
expect(i18n.language).toBeDefined() | ||
expect(i18n.messages).toBeDefined() | ||
expect(console.warn).toBeCalledWith(expect.stringContaining('DEPRECATED (removal in 1.x):')) | ||
}) | ||
}) | ||
it('should subscribe a callback on mount', function () { | ||
expect(context.subscribe).not.toBeCalled() | ||
mountHoc() | ||
expect(context.subscribe).toBeCalled() | ||
expect(context.subscribe.mock.calls[0][0]).toBeInstanceOf(Function) | ||
mockConsole(console => { | ||
expect(context.subscribe).not.toBeCalled() | ||
mountHoc() | ||
expect(context.subscribe).toBeCalled() | ||
expect(context.subscribe.mock.calls[0][0]).toBeInstanceOf(Function) | ||
expect(console.warn).toBeCalledWith(expect.stringContaining('DEPRECATED (removal in 1.x):')) | ||
}) | ||
}) | ||
it('should unsubscribe a callback on unmount', function () { | ||
const { node } = mountHoc() | ||
mockConsole(console => { | ||
const { node } = mountHoc() | ||
expect(context.unsubscribe).not.toBeCalled() | ||
node.unmount() | ||
expect(context.unsubscribe).toBeCalled() | ||
expect(context.unsubscribe.mock.calls[0][0]).toBeInstanceOf(Function) | ||
expect(context.unsubscribe).not.toBeCalled() | ||
node.unmount() | ||
expect(context.unsubscribe).toBeCalled() | ||
expect(context.unsubscribe.mock.calls[0][0]).toBeInstanceOf(Function) | ||
expect(console.warn).toBeCalledWith(expect.stringContaining('DEPRECATED (removal in 1.x):')) | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
101626
37
1932
0
6
- Removedlingui-formats@0.4.6(transitive)
- Removedlingui-i18n@0.7.0-3(transitive)
- Removedmake-plural@4.3.0(transitive)
- Removedmessageformat-parser@1.1.0(transitive)
- Removedminimist@1.2.8(transitive)
Updatedlingui-formats@^undefined
Updatedlingui-i18n@^undefined