Skip to content

Commit

Permalink
Indent member expressions
Browse files Browse the repository at this point in the history
A rule to this effect is coming in JavaScript Standard Style:
standard/standard#628
  • Loading branch information
kemitchell committed Apr 27, 2017
1 parent f8ee1a4 commit 995d131
Show file tree
Hide file tree
Showing 17 changed files with 306 additions and 304 deletions.
8 changes: 4 additions & 4 deletions index.js
Expand Up @@ -224,10 +224,10 @@ window.addEventListener('popstate', update)
// Copy Links

new Clipboard('.copy')
.on('success', function (event) {
window.alert('Copied')
event.clearSelection()
})
.on('success', function (event) {
window.alert('Copied')
event.clearSelection()
})

if (module.parent) {
module.exports = render
Expand Down
2 changes: 1 addition & 1 deletion models/form.js
Expand Up @@ -535,7 +535,7 @@ module.exports = function (initialize, reduction, handler) {
}
filesaver(
docx(clone(state.tree), state.blanks, options)
.generate({type: 'blob'}),
.generate({type: 'blob'}),
fileName(title, 'docx'),
true
)
Expand Down
82 changes: 41 additions & 41 deletions proxy.js
Expand Up @@ -7,46 +7,46 @@ var httpProxy = require('http-proxy')
var proxy = httpProxy.createProxyServer({})

http
.createServer(corsify(function (request, response) {
var newHeaders = [
['Pragma', 'no-cache'],
['Expires', '0'],
['Cache-Control', 'no-cache, no-store, must-revalidate'],
['Access-Control-Allow-Origin', 'http://localhost:8000'],
['Access-Control-Allow-Credentials', 'true'],
[
'Access-Control-Allow-Headers', [
'Cache-Control',
'Content-Type',
'DNT',
'If-Modified-Since',
'Keep-Alive',
'User-Agent',
'X-CustomHeader',
'X-Requested-With'
].join(', ')
],
['Access-Control-Allow-Methods', http.METHODS.join(', ')],
[
'Access-Control-Expose-Headers', [
'Content-Type',
'Location'
].join()
.createServer(corsify(function (request, response) {
var newHeaders = [
['Pragma', 'no-cache'],
['Expires', '0'],
['Cache-Control', 'no-cache, no-store, must-revalidate'],
['Access-Control-Allow-Origin', 'http://localhost:8000'],
['Access-Control-Allow-Credentials', 'true'],
[
'Access-Control-Allow-Headers', [
'Cache-Control',
'Content-Type',
'DNT',
'If-Modified-Since',
'Keep-Alive',
'User-Agent',
'X-CustomHeader',
'X-Requested-With'
].join(', ')
],
['Access-Control-Allow-Methods', http.METHODS.join(', ')],
[
'Access-Control-Expose-Headers', [
'Content-Type',
'Location'
].join()
]
]
]
var oldWriteHead = response.writeHead
response.writeHead = function (code, headers) {
newHeaders.forEach(function (newHeader) {
response.setHeader(newHeader[0], newHeader[1])
if (headers && headers[newHeader[0]]) {
delete headers[newHeader[0]]
}
var oldWriteHead = response.writeHead
response.writeHead = function (code, headers) {
newHeaders.forEach(function (newHeader) {
response.setHeader(newHeader[0], newHeader[1])
if (headers && headers[newHeader[0]]) {
delete headers[newHeader[0]]
}
})
oldWriteHead.apply(response, arguments)
}
proxy.web(request, response, {
target: process.env.TARGET || 'http://localhost:8081',
secure: false
})
oldWriteHead.apply(response, arguments)
}
proxy.web(request, response, {
target: process.env.TARGET || 'http://localhost:8081',
secure: false
})
}))
.listen(process.env.PORT || 8080)
}))
.listen(process.env.PORT || 8080)
46 changes: 23 additions & 23 deletions server.js
Expand Up @@ -13,29 +13,29 @@ var ecstatic = require('ecstatic')({
function serveIndex (response) {
response.setHeader('Content-Type', 'text/html')
fs.createReadStream('build/index.html')
.pipe(replace(/RELEASE\//g, release))
.pipe(response)
.pipe(replace(/RELEASE\//g, release))
.pipe(response)
}

http
.createServer(function (request, response) {
response.setHeader(
'Cache-Control', 'no-cache, no-store, must-revalidate'
)
response.setHeader('Pragma', 'no-cache')
response.setHeader('Expires', '0')
var pathname = url.parse(request.url).pathname
if (pathname === '/') {
serveIndex(response)
} else if (
pathname.startsWith('/forms/') ||
pathname.startsWith('/publications/') ||
pathname.startsWith('/publishers') ||
pathname.startsWith('/search')
) {
serveIndex(response)
} else {
ecstatic(request, response)
}
})
.listen(8000)
.createServer(function (request, response) {
response.setHeader(
'Cache-Control', 'no-cache, no-store, must-revalidate'
)
response.setHeader('Pragma', 'no-cache')
response.setHeader('Expires', '0')
var pathname = url.parse(request.url).pathname
if (pathname === '/') {
serveIndex(response)
} else if (
pathname.startsWith('/forms/') ||
pathname.startsWith('/publications/') ||
pathname.startsWith('/publishers') ||
pathname.startsWith('/search')
) {
serveIndex(response)
} else {
ecstatic(request, response)
}
})
.listen(8000)
104 changes: 52 additions & 52 deletions test/comparison.test.js
Expand Up @@ -15,27 +15,27 @@ tape.skip('Comparison', function (suite) {
suite.test(function (test) {
test.plan(1)
webdriver
.url('http://localhost:8000/forms/' + apache2 + '/' + edited)
.isExisting('//*[contains(text(),"compared to")]')
.then(function (existing) {
test.assert(
existing,
'Displays "compared to" when diffing.'
)
})
.url('http://localhost:8000/forms/' + apache2 + '/' + edited)
.isExisting('//*[contains(text(),"compared to")]')
.then(function (existing) {
test.assert(
existing,
'Displays "compared to" when diffing.'
)
})
})

suite.test(function (test) {
test.plan(1)
webdriver
.url('http://localhost:8000/forms/' + apache2 + '/' + edited)
.isExisting('//del//span[contains(text(),"whether")]')
.then(function (existing) {
test.assert(
existing,
'Displays "whether" as a deletion.'
)
})
.url('http://localhost:8000/forms/' + apache2 + '/' + edited)
.isExisting('//del//span[contains(text(),"whether")]')
.then(function (existing) {
test.assert(
existing,
'Displays "whether" as a deletion.'
)
})
})

var abc = (
Expand All @@ -51,29 +51,29 @@ tape.skip('Comparison', function (suite) {
suite.test(function (test) {
test.plan(1)
webdriver
.url('http://localhost:8000/forms/' + abc + '/' + bcd)
.waitForExist('//del//p[contains(text(),"This is A.")]')
.isExisting('//del//p[contains(text(),"This is A.")]')
.then(function (existing) {
test.assert(
existing,
'Displays This is A." as a deletion.'
)
})
.url('http://localhost:8000/forms/' + abc + '/' + bcd)
.waitForExist('//del//p[contains(text(),"This is A.")]')
.isExisting('//del//p[contains(text(),"This is A.")]')
.then(function (existing) {
test.assert(
existing,
'Displays This is A." as a deletion.'
)
})
})

suite.test(function (test) {
test.plan(1)
webdriver
.url('http://localhost:8000/forms/' + abc + '/' + bcd)
.waitForExist('//ins//p[contains(text(),"This is D.")]')
.isExisting('//ins//p[contains(text(),"This is D.")]')
.then(function (existing) {
test.assert(
existing,
'Displays "This is D." as an insertion.'
)
})
.url('http://localhost:8000/forms/' + abc + '/' + bcd)
.waitForExist('//ins//p[contains(text(),"This is D.")]')
.isExisting('//ins//p[contains(text(),"This is D.")]')
.then(function (existing) {
test.assert(
existing,
'Displays "This is D." as an insertion.'
)
})
})

var a = (
Expand All @@ -89,28 +89,28 @@ tape.skip('Comparison', function (suite) {
suite.test(function (test) {
test.plan(1)
webdriver
.url('http://localhost:8000/forms/' + a + '/' + aConspicuous)
.waitForExist('//*[contains(text(),"Made conspicuous")]')
.isExisting('//*[contains(text(),"Made conspicuous")]')
.then(function (existing) {
test.assert(
existing,
'Displays "Made conspicuous".'
)
})
.url('http://localhost:8000/forms/' + a + '/' + aConspicuous)
.waitForExist('//*[contains(text(),"Made conspicuous")]')
.isExisting('//*[contains(text(),"Made conspicuous")]')
.then(function (existing) {
test.assert(
existing,
'Displays "Made conspicuous".'
)
})
})

suite.test(function (test) {
test.plan(1)
webdriver
.url('http://localhost:8000/forms/' + aConspicuous + '/' + a)
.waitForExist('//*[contains(text(),"Made inconspicuous")]')
.isExisting('//*[contains(text(),"Made inconspicuous")]')
.then(function (existing) {
test.assert(
existing,
'Displays "Made inconspicuous".'
)
})
.url('http://localhost:8000/forms/' + aConspicuous + '/' + a)
.waitForExist('//*[contains(text(),"Made inconspicuous")]')
.isExisting('//*[contains(text(),"Made inconspicuous")]')
.then(function (existing) {
test.assert(
existing,
'Displays "Made inconspicuous".'
)
})
})
})
18 changes: 9 additions & 9 deletions test/display.test.js
Expand Up @@ -5,14 +5,14 @@ tape('Display', function (test) {
test.test('Sanity Check', function (test) {
test.plan(1)
webdriver
.url('http://localhost:8000')
.getText('a.openSource')
.then(function (value) {
test.equal(
value,
'Common Form is open-source software.',
'a.openSource says "Common Form is open-source software."'
)
})
.url('http://localhost:8000')
.getText('a.openSource')
.then(function (value) {
test.equal(
value,
'Common Form is open-source software.',
'a.openSource says "Common Form is open-source software."'
)
})
})
})
38 changes: 19 additions & 19 deletions test/edit.test.js
Expand Up @@ -34,25 +34,25 @@ tape('Edits', function (suite) {
test.ifError(error)
var firstHeading = '(//input[@class="heading"])[1]'
webdriver
.url(testURL)
.waitForExist(firstHeading)
// Select the only heading.
.click(firstHeading)
// Backspace the current heading.
.keys('\uE003'.repeat(20))
// Type a new one.
.keys('Edited')
// Hit Enter.
.keys('\uE006')
.waitForText('.digest', merkleize(after).digest)
.getUrl()
.then(function (url) {
test.equal(
url,
'http://localhost:8000/forms/' + merkleize(after).digest,
'updates location bar'
)
})
.url(testURL)
.waitForExist(firstHeading)
// Select the only heading.
.click(firstHeading)
// Backspace the current heading.
.keys('\uE003'.repeat(20))
// Type a new one.
.keys('Edited')
// Hit Enter.
.keys('\uE006')
.waitForText('.digest', merkleize(after).digest)
.getUrl()
.then(function (url) {
test.equal(
url,
'http://localhost:8000/forms/' + merkleize(after).digest,
'updates location bar'
)
})
})
})
})

0 comments on commit 995d131

Please sign in to comment.