diff --git a/docs/components/application-wrapper.js b/docs/components/application-wrapper.js index b5eb173ea8e..84d0c1f266a 100644 --- a/docs/components/application-wrapper.js +++ b/docs/components/application-wrapper.js @@ -1,7 +1,6 @@ import React from 'react'; if (typeof window !== 'undefined') { - window.MapboxPageShellProduction = true; import(/* webpackChunkName: "assembly-js" */ '@mapbox/mbx-assembly/dist/assembly.js'); } diff --git a/docs/pages/example/jump-to.html b/docs/pages/example/jump-to.html index b0c21a7db69..d72543d613b 100644 --- a/docs/pages/example/jump-to.html +++ b/docs/pages/example/jump-to.html @@ -73,7 +73,6 @@ ] }; -mapboxgl.accessToken = 'pk.eyJ1IjoibWFsLXdvb2QiLCJhIjoiY2oyZ2t2em50MDAyMzJ3cnltMDFhb2NzdiJ9.X-D4Wvo5E5QxeP7K_I3O8w'; var map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/streets-v11', diff --git a/test/unit/docs/examples.test.js b/test/unit/docs/examples.test.js index 1870a8a447a..b3699fc7c21 100644 --- a/test/unit/docs/examples.test.js +++ b/test/unit/docs/examples.test.js @@ -27,7 +27,8 @@ const readPost = filename => { } }; -const listExamples = dir => { + +const listExamplesJs = dir => { const files = fs.readdirSync(`${dir}`); return files.reduce((arr, file) => { if (path.extname(file) === '.js') { @@ -37,7 +38,18 @@ const listExamples = dir => { }, []); }; -listExamples('./docs/pages/example/').forEach((example) => { +const listExamplesHtml = dir => { + const files = fs.readdirSync(`${dir}`); + return files.reduce((arr, file) => { + if (path.extname(file) === '.html') { + arr.push(`${dir}${file}`); + } + return arr; + }, []); +}; + +// Test .js files +listExamplesJs('./docs/pages/example/').forEach((example) => { const file = readPost(example); const metadata = file.metadata; @@ -65,3 +77,12 @@ listExamples('./docs/pages/example/').forEach((example) => { }); } }); + +// Test .html files +listExamplesHtml('./docs/pages/example/').forEach((example) => { + const file = readPost(example); + test(`Example: ${example}`, (t) => { + t.ok(!file.file.includes('pk.ey'), 'do not hardcode access tokens, an access token will be appended automatically'); + t.end(); + }); +}); diff --git a/vendor/docs-page-shell/page-shell-script.js b/vendor/docs-page-shell/page-shell-script.js index 9fb9b6f35a1..f3c6764b924 100644 --- a/vendor/docs-page-shell/page-shell-script.js +++ b/vendor/docs-page-shell/page-shell-script.js @@ -1,2 +1,2 @@ /*eslint-disable*/ -!function(){"use strict";var S,t="https://www.mapbox.com",i="https://122e4e-mapbox.global.ssl.fastly.net",s=640,L=[];function x(e){var t=e.triggerEl,n=e.pointerEl,o=e.onCrossMobileThreshhold,i=e.menuBodyContainerEl,a=e.menuBodyEl,r=e||M,c=function(){window.matchMedia("(min-width: ".concat(s,"px)")).matches?r({pointerEl:n,triggerEl:t,menuBodyContainerEl:i,menuBodyEl:a}):o&&o()};L.push(c),window.addEventListener("resize",c)}function M(e){var t=e.pointerEl,n=e.triggerEl.getBoundingClientRect();t.style.left=Math.round(n.left+n.width/2)+"px"}var a,r,B,I=function(o,i,a){var r,c,s,l,t=!1,u=!1,n={},d=0,m=0,v={sensitivity:7,interval:100,timeout:0,handleFocus:!1};function f(e){r=e.clientX,c=e.clientY}function e(e){return t=!0,m&&(m=clearTimeout(m)),o.removeEventListener("mousemove",f,!1),1!==d&&(s=e.clientX,l=e.clientY,o.addEventListener("mousemove",f,!1),m=setTimeout(function(){!function e(t,n){if(m&&(m=clearTimeout(m)),Math.abs(s-r)+Math.abs(l-c)