@@ -10,12 +10,12 @@ beforeEach(async () => {
10
10
global . URL . revokeObjectURL = jest . fn ( ) ;
11
11
12
12
document . body . innerHTML = `
13
- <form id="generateForm ">
13
+ <form id="generate-form ">
14
14
<input id="repo" />
15
- <input type="checkbox" id="useBatchToken " />
16
- <input type="checkbox" id="useVirtualDisplay " />
17
- <input type="checkbox" id="buildAcrossPlatforms " />
18
- <button type="submit" id="generateButton "></button>
15
+ <input type="checkbox" id="use-batch-token " />
16
+ <input type="checkbox" id="use-virtual-display " />
17
+ <input type="checkbox" id="build-across-platforms " />
18
+ <button type="submit" id="generate-button "></button>
19
19
</form>
20
20
<a id="downloadButton"></a>
21
21
` ;
@@ -29,7 +29,7 @@ test("form submit with invalid repo shows error", () => {
29
29
expect ( repoInput . classList . contains ( "is-invalid" ) ) . toBe ( false ) ;
30
30
repoInput . value = "invalidrepo" ;
31
31
document
32
- . getElementById ( "generateForm " )
32
+ . getElementById ( "generate-form " )
33
33
. dispatchEvent ( new Event ( "submit" , { bubbles : true , cancelable : true } ) ) ;
34
34
expect ( repoInput . classList . contains ( "is-invalid" ) ) . toBe ( true ) ;
35
35
expect ( window . navigateTo ) . not . toHaveBeenCalled ( ) ;
@@ -39,7 +39,7 @@ test("form submit with valid slug works", () => {
39
39
const repoInput = document . getElementById ( "repo" ) ;
40
40
repoInput . value = "owner/repo" ;
41
41
document
42
- . getElementById ( "generateForm " )
42
+ . getElementById ( "generate-form " )
43
43
. dispatchEvent ( new Event ( "submit" , { bubbles : true , cancelable : true } ) ) ;
44
44
expect ( window . navigateTo ) . toHaveBeenCalledWith (
45
45
expect . stringContaining ( "https://github.com/owner/repo/new/main?filename=" ) ,
@@ -50,7 +50,7 @@ test("form submit with valid URL works", () => {
50
50
const repoInput = document . getElementById ( "repo" ) ;
51
51
repoInput . value = "https://github.com/octocat/Hello-World" ;
52
52
document
53
- . getElementById ( "generateForm " )
53
+ . getElementById ( "generate-form " )
54
54
. dispatchEvent ( new Event ( "submit" , { bubbles : true , cancelable : true } ) ) ;
55
55
expect ( window . navigateTo ) . toHaveBeenCalledWith (
56
56
expect . stringContaining (
@@ -63,7 +63,7 @@ test("form submit with valid cloud-hosted enterprise URL works", () => {
63
63
const repoInput = document . getElementById ( "repo" ) ;
64
64
repoInput . value = "https://github.com/enterprises/gh/octocat/Hello-World" ;
65
65
document
66
- . getElementById ( "generateForm " )
66
+ . getElementById ( "generate-form " )
67
67
. dispatchEvent ( new Event ( "submit" , { bubbles : true , cancelable : true } ) ) ;
68
68
expect ( window . navigateTo ) . toHaveBeenCalledWith (
69
69
expect . stringContaining (
@@ -72,11 +72,6 @@ test("form submit with valid cloud-hosted enterprise URL works", () => {
72
72
) ;
73
73
} ) ;
74
74
75
- test ( "download button triggers download" , ( ) => {
76
- document . getElementById ( "downloadButton" ) . click ( ) ;
77
- expect ( global . URL . createObjectURL ) . toHaveBeenCalled ( ) ;
78
- } ) ;
79
-
80
75
test ( "advanced options are passed to generateWorkflow" , async ( ) => {
81
76
// Re-import main.js with a spy on generateWorkflow
82
77
jest . resetModules ( ) ;
@@ -87,13 +82,13 @@ test("advanced options are passed to generateWorkflow", async () => {
87
82
} ) ) ;
88
83
window . jsyaml = { dump : ( ) => "yaml-content" } ;
89
84
document . getElementById ( "repo" ) . value = "o/r" ;
90
- document . getElementById ( "useBatchToken " ) . checked = true ;
91
- document . getElementById ( "useVirtualDisplay " ) . checked = false ;
92
- document . getElementById ( "buildAcrossPlatforms " ) . checked = true ;
85
+ document . getElementById ( "use-batch-token " ) . checked = true ;
86
+ document . getElementById ( "use-virtual-display " ) . checked = false ;
87
+ document . getElementById ( "build-across-platforms " ) . checked = true ;
93
88
await import ( "../public/scripts/main.js" ) ;
94
89
window . navigateTo = jest . fn ( ) ;
95
90
document
96
- . getElementById ( "generateForm " )
91
+ . getElementById ( "generate-form " )
97
92
. dispatchEvent ( new Event ( "submit" , { bubbles : true , cancelable : true } ) ) ;
98
93
expect ( workflowSpy ) . toHaveBeenCalledWith ( {
99
94
useBatchToken : true ,
0 commit comments