Skip to content

Commit 0bc8a06

Browse files
authored
Merge pull request #406 from Gregoor/new-context-api
Use React's new Context API
2 parents ac5f743 + d02a9c5 commit 0bc8a06

39 files changed

+2056
-2164
lines changed

common.mk

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,6 @@ lint:
1919
@eslint --config $(ROOT)/eslint_test.json --max-warnings 0 test/
2020
@echo -e " $(OK) $@"
2121

22-
test:
23-
ifneq (,$(wildcard ./test/index.js))
24-
@nyc --reporter=text --reporter=html mocha \
25-
--recursive --ui tdd \
26-
--require $(ROOT)/mocha_setup \
27-
--require ./test/index \
28-
test/**/*_test.js
29-
else
30-
@nyc --reporter=text --reporter=html mocha \
31-
--recursive --ui tdd \
32-
--require $(ROOT)/mocha_setup \
33-
test/**/*_test.js
34-
endif
35-
3622
html:
3723
ifneq (,$(wildcard ./.esdoc.json))
3824
@esdoc

fluent-bundle/makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ include ../common.mk
55

66
build: index.js compat.js
77

8+
test:
9+
@nyc --reporter=text --reporter=html mocha \
10+
--recursive --ui tdd \
11+
--require $(ROOT)/mocha_setup \
12+
--require ./test/index \
13+
test/**/*_test.js
14+
815
index.js: $(SOURCES)
916
@rollup $(CURDIR)/src/index.js \
1017
--config $(ROOT)/bundle_config.js \

fluent-dedent/makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ include ../common.mk
55

66
build: index.js compat.js
77

8+
test:
9+
@nyc --reporter=text --reporter=html mocha \
10+
--recursive --ui tdd \
11+
--require $(ROOT)/mocha_setup \
12+
test/**/*_test.js
13+
814
index.js: $(SOURCES)
915
@rollup $(CURDIR)/src/index.js \
1016
--config $(ROOT)/bundle_config.js \

fluent-dom/makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ DEPS := cached-iterable:CachedIterable
44

55
include ../common.mk
66

7+
test:
8+
@nyc --reporter=text --reporter=html mocha \
9+
--recursive --ui tdd \
10+
--require $(ROOT)/mocha_setup \
11+
--require ./test/index \
12+
test/**/*_test.js
13+
714
build: index.js compat.js
815

916
index.js: $(SOURCES)

fluent-gecko/makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ include ../common.mk
66
version = $(1)@$(shell node -e "\
77
console.log(require('../$(1)/package.json').version)")
88

9+
test:
10+
@nyc --reporter=text --reporter=html mocha \
11+
--recursive --ui tdd \
12+
--require $(ROOT)/mocha_setup \
13+
test/**/*_test.js
14+
915
build: Fluent.jsm FluentSyntax.jsm Localization.jsm DOMLocalization.jsm l10n.js fluent-react.js
1016

1117
Fluent.jsm: $(SOURCES)

fluent-langneg/makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ GLOBAL := FluentLangNeg
33

44
include ../common.mk
55

6+
test:
7+
@nyc --reporter=text --reporter=html mocha \
8+
--recursive --ui tdd \
9+
--require $(ROOT)/mocha_setup \
10+
test/**/*_test.js
11+
612
build: index.js compat.js
713

814
index.js: $(SOURCES)

fluent-react/babel.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Jest requires us to specify the transforms it needs to run the tests
2+
module.exports = {
3+
"presets": [
4+
"@babel/preset-react",
5+
["@babel/preset-env", {
6+
"targets": "node >= 8.9.0"
7+
}]
8+
],
9+
"plugins": [
10+
["babel-plugin-transform-rename-import", {
11+
"original": "fluent",
12+
"replacement": "fluent/compat"
13+
}],
14+
"@babel/plugin-proposal-async-generator-functions"
15+
],
16+
};

fluent-react/makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ include ../common.mk
66

77
build: index.js compat.js
88

9+
test:
10+
jest --collect-coverage
11+
912
index.js: $(SOURCES)
1013
@rollup $(CURDIR)/src/index.js \
1114
--config $(ROOT)/bundle_config.js \

fluent-react/package.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,20 @@
5555
"react": "^0.14.9 || ^15.0.0 || ^16.0.0"
5656
},
5757
"devDependencies": {
58-
"@babel/preset-react": "^7.0.0-beta.47",
58+
"@babel/plugin-proposal-async-generator-functions": "^7.2.0",
59+
"@babel/preset-env": "^7.5.5",
60+
"@babel/preset-react": "7.0.0",
61+
"babel-jest": "^24.8.0",
5962
"babel-plugin-transform-rename-import": "^2.2.0",
60-
"enzyme": "^3.3.0",
61-
"enzyme-adapter-react-16": "^1.1.1",
62-
"jsdom": "^11.12.0",
63+
"jest": "^24.8.0",
64+
"prettier": "^1.18.2",
6365
"react": "^16.2.0",
6466
"react-dom": "^16.2.0",
65-
"sinon": "^4.2.2"
67+
"react-test-renderer": "^16.8.6"
68+
},
69+
"jest": {
70+
"transformIgnorePatterns": [
71+
"node_modules/(?!(@fluent/sequence)/)"
72+
]
6673
}
6774
}

fluent-react/src/context.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { createContext } from "react";
2+
import ReactLocalization from "./localization";
3+
4+
export default createContext({
5+
l10n: new ReactLocalization([]),
6+
parseMarkup: null
7+
});

0 commit comments

Comments
 (0)