
If the user starts writing a diff comment, but discards it or navigates away before saving it as a draft, then the text that had been entered re-appears if the user starts a comment on the same line of the same file of the same patch-set of the same change. Achieves this by storing the comment text in localStorage along with a timestamp whenever the textarea is edited by the user. The entry is cleared from localStorage if the user saves the comment as a draft. When a new comment is started, the gr-diff-comment checks localStorage to see whether a relevant entry exists to use as the initial text. Adds the gr-storage element as an interface for localStorage. This element clears away stored comment drafts if they are more than a day old. Bug: Issue 3787 Change-Id: I11327a69d463a6a84a0cd8d59f4662a6a4c296a6
PolyGerrit
Installing Node.js
# Debian/Ubuntu
sudo apt-get install nodejs-legacy
# OS X with Homebrew
brew install node
All other platforms: download from nodejs.org.
Optional: installing go
This is only required for running the run-server.sh
script for testing. See below.
# Debian/Ubuntu
sudo apt-get install golang
# OS X with Homebrew
brew install go
All other platforms: download from golang.org
Add [go] to your path
PATH=$PATH:/usr/local/go/bin
Local UI, Production Data
To test the local UI against gerrit-review.googlesource.com:
./polygerrit-ui/run-server.sh
Then visit http://localhost:8081
Local UI, Test Data
One-time setup:
- Install Buck for building Gerrit.
- Build Gerrit and set up a local test site.
Run a test server:
buck build polygerrit && \
java -jar buck-out/gen/polygerrit/polygerrit.war daemon --polygerrit-dev -d ../gerrit_testsite --console-log --show-stack-trace
Running Tests
One-time setup:
# Debian/Ubuntu
sudo apt-get install npm
# OS X with Homebrew
brew install npm
# All platforms (including those above)
sudo npm install -g web-component-tester
Run all web tests:
buck test --no-results-cache --include web
The --no-results-cache
flag prevents flaky test failures from being
cached.
If you need to pass additional arguments to wct
:
WCT_ARGS='-p --some-flag="foo bar"' buck test --no-results-cache --include web
For interactively working on a single test file, do the following:
./polygerrit-ui/run-server.sh
Then visit http://localhost:8081/elements/foo/bar_test.html
Style guide
We follow the Google JavaScript Style Guide with a few exceptions. When in doubt, remain consistent with the code around you.