Skip to content

Commit 89b40c7

Browse files
committed
update: --
1 parent 20a8796 commit 89b40c7

File tree

200 files changed

+143118
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+143118
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@
230230
- [Vue 实现前进刷新,后退不刷新的效果](./企业级/实现前进刷新.js)
231231
- [Vue 页面权限控制和登陆验证](./企业级/页面权限控制和登陆验证.js)
232232

233+
## React全家桶 🪣 (react文件夹 📁 下)
234+
235+
- [第一个React Web应用程序](./react/Web应用程序.md)
233236

234237
## 常见问题及解答
235238

react/Web应用程序.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## 第一个React Web应用程序
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+

react/voting_app/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
reports/
2+
tests_output/
3+
npm-debug.log.*

react/voting_app/.test.bats

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bats
2+
DIR=$(dirname $BATS_TEST_FILENAME)
3+
4+
load "${BOOK_ROOT}/scripts/bats/fullstack.bats"
5+
load "${BOOK_ROOT}/scripts/bats-support/load.bash"
6+
load "${BOOK_ROOT}/scripts/bats-assert/load.bash"
7+
8+
@test "voting_app e2e passses" {
9+
cd $DIR
10+
run_npm_cmd test $TEST_TMP_DIR || :
11+
run cat ${TEST_TMP_DIR}/log.txt
12+
assert_output --partial 'OK.'
13+
}
14+
15+
setup() {
16+
echo "travis_fold:start:bats_voting_app"
17+
cd $DIR
18+
TEST_TMP_DIR="$(mktemp -d -t fullstackXXX)"
19+
kill_by_grep "concurrently" || :
20+
kill_by_port 3000 || :
21+
# ng serve 3>- &
22+
true
23+
}
24+
25+
teardown() {
26+
cd $DIR
27+
kill_by_grep "concurrently" || :
28+
# temp_del "$TEST_TMP_DIR"
29+
kill_by_port 3000 || :
30+
echo "travis_fold:end:bats_voting_app"
31+
true
32+
}

react/voting_app/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Running the app
2+
3+
1. Ensure you have `npm` installed.
4+
5+
Follow the instructions for your platform [here](https://github.com/npm/npm).
6+
7+
2. Install `http-server`
8+
9+
````
10+
npm install
11+
````
12+
13+
3. Boot the HTTP server
14+
15+
````
16+
npm run server
17+
````
18+
19+
The server is now running at [localhost:3000](localhost:3000)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// More info: http://stackoverflow.com/a/2068407/862877
2+
3+
module.exports = function(req, res, next) {
4+
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
5+
res.setHeader("Pragma", "no-cache");
6+
res.setHeader("Expires", "0");
7+
next();
8+
}

react/voting_app/nightwatch.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const seleniumServer = require("selenium-server");
2+
const chromedriver = require("chromedriver");
3+
4+
module.exports = {
5+
src_folders: ["tests/e2e"],
6+
custom_commands_path: "",
7+
custom_assertions_path: "",
8+
page_objects_path: "",
9+
globals_path: "",
10+
11+
selenium: {
12+
start_process: true,
13+
server_path: seleniumServer.path,
14+
log_path: "",
15+
host: "127.0.0.1",
16+
port: 4444,
17+
cli_args: {
18+
"webdriver.chrome.driver": chromedriver.path
19+
}
20+
},
21+
22+
test_settings: {
23+
default: {
24+
launch_url: "http://localhost",
25+
selenium_port: 4444,
26+
selenium_host: "localhost",
27+
silent: true,
28+
screenshots: {
29+
enabled: false,
30+
path: ""
31+
},
32+
desiredCapabilities: {
33+
browserName: "chrome",
34+
javascriptEnabled: true,
35+
acceptSslCerts: true
36+
}
37+
}
38+
}
39+
};

0 commit comments

Comments
 (0)