@@ -25,10 +25,14 @@ describe("login", () => {
2525 // Create a fake element and set the attribute
2626 const mockElement = document . createElement ( "input" )
2727 mockElement . setAttribute ( "id" , "base" )
28- mockElement . setAttribute (
29- "data-settings" ,
30- '{"base":"./hello-world","csStaticBase":"./static/development/Users/jp/Dev/code-server","logLevel":2,"disableTelemetry":false,"disableUpdateCheck":false}' ,
31- )
28+ const expected = {
29+ base : "./hello-world" ,
30+ csStaticBase : "./static/development/Users/jp/Dev/code-server" ,
31+ logLevel : 2 ,
32+ disableTelemetry : false ,
33+ disableUpdateCheck : false ,
34+ }
35+ mockElement . setAttribute ( "data-settings" , JSON . stringify ( expected ) )
3236 document . body . appendChild ( mockElement )
3337 spy . mockImplementation ( ( ) => mockElement )
3438 // Load file
@@ -38,32 +42,4 @@ describe("login", () => {
3842 expect ( el ?. value ) . toBe ( "/hello-world" )
3943 } )
4044 } )
41-
42- describe ( "there is no element with id 'base'" , ( ) => {
43- let initialDom : Document
44- beforeEach ( ( ) => {
45- const dom = new JSDOM ( )
46- initialDom = dom . window . document
47- global . document = dom . window . document
48-
49- const location : LocationLike = {
50- pathname : "/healthz" ,
51- origin : "http://localhost:8080" ,
52- }
53-
54- global . location = location as Location
55- } )
56- afterEach ( ( ) => {
57- // Reset the global.document
58- global . document = undefined as any as Document
59- global . location = undefined as any as Location
60- } )
61-
62- it ( "should not change the DOM" , ( ) => {
63- // Load file
64- require ( "../../../src/browser/pages/login" )
65- const currentDom = global . document
66- expect ( initialDom ) . toBe ( currentDom )
67- } )
68- } )
6945} )
0 commit comments