Skip to content

Commit

Permalink
fix(generate-examples-index): use HTTPS for JSFiddle (#7)
Browse files Browse the repository at this point in the history
* fix(generate-examples-index): use HTTPS on JSFiddle

Note: CodePen has always been secure.

* test: update snapshots

The URLs changed from HTTP to HTTPS so the snapshots have to be updated.

* fix(generate-examples-index): fix a type error

I have no idea how this could have passed through type checking the last
time.
  • Loading branch information
Thomaash authored and yotamberk committed Jan 12, 2020
1 parent 91c875a commit 36ccd59
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
52 changes: 26 additions & 26 deletions __snapshots__/test/generate-examples-index/basic.test.ts.js
Expand Up @@ -514,7 +514,7 @@ exports['generate-examples-index snapshots broken html file contents generated/p
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -560,7 +560,7 @@ exports['generate-examples-index snapshots broken html file contents generated/p
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -606,7 +606,7 @@ exports['generate-examples-index snapshots broken html file contents generated/p
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -652,7 +652,7 @@ exports['generate-examples-index snapshots broken html file contents generated/p
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -698,7 +698,7 @@ exports['generate-examples-index snapshots broken html file contents generated/p
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -744,7 +744,7 @@ exports['generate-examples-index snapshots broken html file contents generated/p
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -790,7 +790,7 @@ exports['generate-examples-index snapshots broken html file contents generated/p
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1136,7 +1136,7 @@ exports['generate-examples-index snapshots broken md file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1182,7 +1182,7 @@ exports['generate-examples-index snapshots broken md file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1228,7 +1228,7 @@ exports['generate-examples-index snapshots broken md file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1274,7 +1274,7 @@ exports['generate-examples-index snapshots broken md file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1320,7 +1320,7 @@ exports['generate-examples-index snapshots broken md file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1366,7 +1366,7 @@ exports['generate-examples-index snapshots broken md file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1412,7 +1412,7 @@ exports['generate-examples-index snapshots broken md file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1904,7 +1904,7 @@ exports['generate-examples-index snapshots okay html file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1950,7 +1950,7 @@ exports['generate-examples-index snapshots okay html file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -1996,7 +1996,7 @@ exports['generate-examples-index snapshots okay html file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2042,7 +2042,7 @@ exports['generate-examples-index snapshots okay html file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2088,7 +2088,7 @@ exports['generate-examples-index snapshots okay html file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2134,7 +2134,7 @@ exports['generate-examples-index snapshots okay html file contents generated/pag
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2444,7 +2444,7 @@ exports['generate-examples-index snapshots okay md file contents generated/pages
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2490,7 +2490,7 @@ exports['generate-examples-index snapshots okay md file contents generated/pages
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2536,7 +2536,7 @@ exports['generate-examples-index snapshots okay md file contents generated/pages
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2582,7 +2582,7 @@ exports['generate-examples-index snapshots okay md file contents generated/pages
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2628,7 +2628,7 @@ exports['generate-examples-index snapshots okay md file contents generated/pages
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down Expand Up @@ -2674,7 +2674,7 @@ exports['generate-examples-index snapshots okay md file contents generated/pages
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down
Expand Up @@ -6,7 +6,7 @@
<body>
<form
id="form"
action="http://jsfiddle.net/api/post/library/pure/"
action="https://jsfiddle.net/api/post/library/pure/"
method="post"
target="_self"
>
Expand Down
5 changes: 4 additions & 1 deletion src/generate-examples-index/index.ts
Expand Up @@ -54,7 +54,10 @@ function getMeta(
): number | string {
const content = page(`meta[name="${name}"]`).attr("content");

if (typeof fallback === "number" && !Number.isNaN(+content)) {
if (content == null) {
// No meta of this name exists in the page, use the fallback.
return fallback;
} else if (typeof fallback === "number" && !Number.isNaN(+content)) {
// Both are numbers.
return +content;
} else if (typeof fallback === "string" && typeof content === "string") {
Expand Down

0 comments on commit 36ccd59

Please sign in to comment.