Skip to content

Commit 7070893

Browse files
committed
upstream_referrer and scss cleanup
1 parent 26dcd26 commit 7070893

File tree

10 files changed

+45
-15
lines changed

10 files changed

+45
-15
lines changed

config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ module.exports = {
5050
SOCKET_API_URL: '"https://socket.tutorcruncher.com"',
5151
GRECAPTCHA_KEY: '"6LdyXRgUAAAAADUNhMVKJDXiRr6DUN8TGOgllqbt"',
5252
RAVEN_DSN: 'null',
53-
// GA_ID: 'null',
54-
GA_ID: '"UA-41117087-3"',
53+
GA_ID: 'null',
54+
// GA_ID: '"UA-41117087-3"',
5555
},
5656
port: 5000,
5757
build_dir: path.resolve(__dirname, 'dev'),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tutorcruncher-socket",
3-
"version": "0.0.11",
3+
"version": "0.0.12",
44
"description": "TutorCruncher socket",
55
"author": "Samuel Colvin <[email protected]>",
66
"private": false,

src/app.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,24 @@ export default {
1212
components: {error}
1313
}
1414
</script>
15+
16+
<style lang="scss">
17+
@import './conf';
18+
19+
.tcs-button {
20+
display: inline-block;
21+
background-color: $button-colour;
22+
color: white;
23+
border-radius: 5px;
24+
font-size: 17px;
25+
padding: 8px 12px;
26+
border: none;
27+
transition: all .3s ease;
28+
outline: none;
29+
cursor: pointer;
30+
text-decoration: none;
31+
&:hover {
32+
background-color: darken($button-colour, 20%);
33+
}
34+
}
35+
</style>

src/components/con-modal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export default {
140140
}
141141
142142
button {
143-
@extend .tcs-button;
143+
@extend %tcs-button;
144144
margin: 10px auto 0;
145145
width: 100%;
146146
}

src/components/enquiry-button.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="tcs-enquiry-modal">
3-
<router-link :to="{name: 'enquiry-modal'}" class="tcs-button tcs-enquiry-button">
3+
<router-link :to="{name: 'enquiry-modal'}" class="tcs-enquiry-button">
44
{{ $root.config.enquiry_button }}
55
</router-link>
66
<router-view></router-view>
@@ -13,4 +13,8 @@ export default {}
1313

1414
<style lang="scss">
1515
@import '../conf';
16+
17+
.tcs-enquiry-button {
18+
@extend %tcs-button;
19+
}
1620
</style>

src/components/enquiry.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export default {
7777
if (this.contractor !== null) {
7878
this.$set(this.$root.enquiry_data, 'contractor', this.contractor.id)
7979
}
80+
this.$set(this.$root.enquiry_data, 'upstream_http_referrer', document.referrer)
8081
this.$root.submit_enquiry(this.submission_complete)
8182
this.$root.ga_event('enquiry-form', 'submitted', this.mode)
8283
},
@@ -138,7 +139,7 @@ form.tcs {
138139
.tcs-submit {
139140
text-align: center;
140141
button {
141-
@extend .tcs-button;
142+
@extend %tcs-button;
142143
font-size: 17px;
143144
padding: 10px 12px;
144145
}

src/conf.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ $size-sm: 768px;
1515
// contact button on modals
1616
$button-colour: $hightlight;
1717

18-
19-
.tcs-button {
18+
%tcs-button {
2019
display: inline-block;
2120
background-color: $button-colour;
2221
color: white;

test/unit/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/* eslint-disable no-extend-native */
33
Function.prototype.bind = require('function-bind')
44

5-
// const testsContext = require.context('./specs', true, /main\.js$/)
5+
// const testsContext = require.context('./specs', true, /enquiry\.js$/)
66
const testsContext = require.context('./specs', true)
77
testsContext.keys().forEach(testsContext)
88

test/unit/specs/_shared.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,20 @@ function generate_vm (router, vm_data_) {
6565
render: h => h('router-view'),
6666
data: vm_data_ || vm_data(),
6767
methods: {
68-
__record_call: function (method_name) {
68+
__record_call: function (method_name, extra_args) {
6969
if (this.hasOwnProperty('method_calls')) {
70-
this.method_calls[method_name] = (this.method_calls[method_name] || 0) + 1
70+
if (this.method_calls[method_name]) {
71+
this.method_calls[method_name].push(extra_args || null)
72+
} else {
73+
this.method_calls[method_name] = [extra_args || null]
74+
}
7175
}
7276
},
7377
get_details: function () { this.__record_call('get_details') },
7478
get_enquiry: function () { this.__record_call('get_enquiry') },
7579
get_text: function () { this.__record_call('get_text') },
7680
submit_enquiry: function (callback) {
77-
this.__record_call('submit_enquiry')
81+
this.__record_call('submit_enquiry', this.enquiry_data)
7882
this.enquiry_data = {}
7983
callback()
8084
},

test/unit/specs/enquiry.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('con-modal.vue, enquiry.vue', () => {
4545
vm.$el.querySelector('form').dispatchEvent(new window.Event('submit'))
4646

4747
await tick()
48-
expect(vm.method_calls['submit_enquiry']).to.equal(1)
48+
expect(vm.method_calls['submit_enquiry']).to.have.lengthOf(1)
4949
expect(vm.enquiry_data).to.deep.equal({})
5050
})
5151
})
@@ -70,7 +70,8 @@ describe('enquiry.vue', () => {
7070
vm.$el.querySelector('form').dispatchEvent(new window.Event('submit'))
7171

7272
await tick()
73-
expect(vm.method_calls['submit_enquiry']).to.equal(1)
73+
expect(vm.method_calls['submit_enquiry']).to.have.lengthOf(1)
74+
expect(vm.method_calls['submit_enquiry'][0].upstream_http_referrer).to.contain('http://localhost')
7475
expect(vm.enquiry_data).to.deep.equal({})
7576
})
7677
})
@@ -93,7 +94,7 @@ describe('enquiry-modal.vue', () => {
9394
vm.$el.querySelector('form').dispatchEvent(new window.Event('submit'))
9495

9596
await tick()
96-
expect(vm.method_calls['submit_enquiry']).to.equal(1)
97+
expect(vm.method_calls['submit_enquiry']).to.have.lengthOf(1)
9798
expect(vm.enquiry_data).to.deep.equal({})
9899

99100
vm.$router.push({name: 'index'})

0 commit comments

Comments
 (0)