diff --git a/_widget/index.html b/_widget/index.html index 109977f6f..b5b66d48e 100644 --- a/_widget/index.html +++ b/_widget/index.html @@ -7,6 +7,14 @@ DNSimple Support Widget + + Click to open the support widget. Remove this DOM element to have it load automatically in the bottom corner. + diff --git a/_widget/src/assets/svgs.js b/_widget/src/assets/svgs.js index f6718bb29..8375eadd2 100644 --- a/_widget/src/assets/svgs.js +++ b/_widget/src/assets/svgs.js @@ -1,6 +1,6 @@ export const backIcon = ''; -export const minimizeIcon = ''; +export const minimizeIcon = ''; export const spinnerIcon = ''; diff --git a/_widget/src/components/app/component.vue b/_widget/src/components/app/component.vue index 30961bc96..c28d0f25e 100644 --- a/_widget/src/components/app/component.vue +++ b/_widget/src/components/app/component.vue @@ -1,14 +1,18 @@ - - + diff --git a/package.json b/package.json index d0ffe4d9c..8907e6965 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,8 @@ "scripts": { "live": "concurrently 'bundle exec nanoc live' 'bundle exec rake compile'", "build": "./node_modules/.bin/webpack && vite build ./_widget", - "lint": "eslint _widget content spec", - "lint:fix": "eslint _widget content spec --fix", + "lint": "eslint _widget src spec", + "lint:fix": "eslint _widget src spec --fix", "widget": "vite serve ./_widget", "test": "jest", "test:watch": "jest --watch" diff --git a/spec/_widget/components/app.spec.js b/spec/_widget/components/app.spec.js index 87047c925..b2fd9f764 100644 --- a/spec/_widget/components/app.spec.js +++ b/spec/_widget/components/app.spec.js @@ -13,7 +13,6 @@ describe('App', () => { it('initialize data attributes', () => { expect(subject.vm.isOpen).toEqual(false); - expect(subject.vm.rootURL).toEqual('https://support.dnsimple.com'); }); it('initialize prompt', () => { diff --git a/spec/search/results.spec.js b/spec/search/results.spec.js deleted file mode 100644 index f867e967d..000000000 --- a/spec/search/results.spec.js +++ /dev/null @@ -1,59 +0,0 @@ -const subject = require('../../content/search/results.js'); - -describe('Results', () => { - describe('.parseQueryParams', () => { - test('can be parsed', () => { - const param = subject.parseQueryParams('?q=a+record&another=param'); - - expect(param).toEqual('a record'); - }); - - test('can be parsed with %20', () => { - const param = subject.parseQueryParams('?q=a%20record&another=param'); - - expect(param).toEqual('a record'); - }); - - test('is empty without valid param', () => { - const param = subject.parseQueryParams('?hello=world'); - - expect(param).toEqual(''); - }); - }); - - describe('.search', () => { - const $input = {}; - - beforeEach(() => { - window.DNSimpleSupport = {}; - window.DNSimpleSupport.search = jest.fn(); - }); - - test('updates input value', () => { - subject.search($input, 'dns'); - - expect($input.value).toContain('dns'); - }); - - test('calls the search agent', () => { - subject.search($input, 'dns'); - - expect(window.DNSimpleSupport.search).toBeCalledWith('dns'); - }); - }); - - describe('.showResults', () => { - test('builds results', () => { - window.DNSimpleSupport = {}; - window.DNSimpleSupport.search = jest.fn(() => { - return [{ title: 'DNS' }]; - }); - - const $main = document.createElement('div'); - const $input = document.createElement('input'); - const $results = subject.showResults($main, $input, 'close'); - - expect($results.innerHTML).toContain('DNS'); - }); - }); -}); diff --git a/src/index.js b/src/index.js index abac13f8d..402c83936 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ function toggleColorMode (e) { // Switch to Light Mode if (e.currentTarget.classList.contains("light--hidden")) { document.documentElement.setAttribute("color-mode", "light"); - localStorage.setItem("color-mode", "light") + localStorage.setItem("color-mode", "light"); return; } diff --git a/templates/search.js.erb b/templates/search.js.erb index 1cb7e22a3..9a9338767 100644 --- a/templates/search.js.erb +++ b/templates/search.js.erb @@ -41,6 +41,7 @@ var loadArticles = function loadArticles (articles) { article.searchBody = article.searchBody || (article.body || '').toLowerCase().replace(PUNCTUATION, ''); article.body = fixRelativeImgSrcs(article.body || ''); article.categories = article.categories || []; + article.source = 'https://support.dnsimple.com'; return article; });