Skip to content

Commit 3afb0da

Browse files
committed
Use a placeholder instead of comment
1 parent 79f8a81 commit 3afb0da

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/app/spec_links.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import utf8 from "utf8";
22

3-
export const DEFAULT_SPEC = "# Type a grammar here:\n\n";
4-
53
export function encode(spec) {
64
return btoa(utf8.encode(spec));
75
}
@@ -19,10 +17,10 @@ export function getURLSearchParamSpec(search) {
1917
} catch (error) {
2018
console.error(error);
2119

22-
return DEFAULT_SPEC;
20+
return "";
2321
}
2422
} else {
25-
return DEFAULT_SPEC;
23+
return "";
2624
}
2725
}
2826

src/components/edit_component.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default function({ spec, specChanged }) {
22
return (
33
<div id="edit">
44
<div className="spec-wrap">
5-
<textarea className="spec" onInput={(e) => { specChanged(e.target.value); }} defaultValue={spec} />
5+
<textarea className="spec" onChange={(e) => { specChanged(e.target.value); }} value={spec} placeholder="Type a grammar here..." />
66
</div>
77
</div>
88
);

test/app/spec_links.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getURLSearchParamSpec, DEFAULT_SPEC, encode, decode } from "../../src/app/spec_links.js";
1+
import { getURLSearchParamSpec, encode, decode } from "../../src/app/spec_links.js";
22
import assert from "node:assert/strict";
33

44
describe("getURLSearchParamSpec", function() {
@@ -23,8 +23,8 @@ describe("getURLSearchParamSpec", function() {
2323
assert.deepStrictEqual(getURLSearchParamSpec(search), expected);
2424
});
2525

26-
it("returns the default spec if the expected search param isn't present", function() {
27-
assert.deepStrictEqual(getURLSearchParamSpec(""), DEFAULT_SPEC);
26+
it("returns an empty string if the expected search param isn't present", function() {
27+
assert.deepStrictEqual(getURLSearchParamSpec(""), "");
2828
});
2929
});
3030

0 commit comments

Comments
 (0)