-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: send hostname
- Loading branch information
Showing
8 changed files
with
89 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,6 @@ | |
}, | ||
"dependencies": { | ||
"core-js": "2.4.1", | ||
"tui-code-snippet": "^1.2.5" | ||
"tui-code-snippet": "^1.3.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* @author NHN Ent. FE Development Team <[email protected]> | ||
* @fileoverview Util | ||
*/ | ||
import {forEach} from 'tui-code-snippet'; | ||
import {forEach, imagePing} from 'tui-code-snippet'; | ||
const {min, max} = Math; | ||
|
||
module.exports = { | ||
|
@@ -71,5 +71,21 @@ module.exports = { | |
} | ||
|
||
return props; | ||
}, | ||
|
||
/** | ||
* send hostname | ||
*/ | ||
sendHostName() { | ||
const {hostname} = location; | ||
|
||
imagePing('https://www.google-analytics.com/collect', { | ||
v: 1, | ||
t: 'event', | ||
tid: 'UA-115377265-9', | ||
cid: hostname, | ||
dp: hostname, | ||
dh: 'image-editor' | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* @fileoverview Test env | ||
* @author NHN Ent. FE Development Lab <[email protected]> | ||
*/ | ||
|
||
import snippet from 'tui-code-snippet'; | ||
import ImageEditor from '../src/js/imageEditor'; | ||
|
||
describe('ImageEditor', () => { | ||
describe('constructor', () => { | ||
let imageEditor; | ||
|
||
afterEach(() => { | ||
imageEditor.destroy(); | ||
}); | ||
|
||
it('should send hostname by default', () => { | ||
const el = document.createElement('div'); | ||
spyOn(snippet, 'imagePing'); | ||
|
||
imageEditor = new ImageEditor(el); | ||
|
||
expect(snippet.imagePing).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should not send hostname on usageStatistics option false', () => { | ||
const el = document.createElement('div'); | ||
spyOn(snippet, 'imagePing'); | ||
|
||
imageEditor = new ImageEditor(el, { | ||
usageStatistics: false | ||
}); | ||
|
||
expect(snippet.imagePing).not.toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |