@@ -179,26 +179,23 @@ describe("DesktopLinuxUrlHandler", () => {
179179 assert . include ( entry , "Icon=/home/al ice/icons/T3\\\\x.png" ) ;
180180 } ) ;
181181
182- it ( "quotes the Exec argument only when it contains a reserved character" , ( ) => {
183- // xdg-open's generic fallback runs `command -v` on the first Exec word
184- // without unquoting it, so a plain path must be written bare.
185- assert . equal (
186- DesktopLinuxUrlHandler . escapeDesktopEntryExecArgument ( "/home/alice/bin/t3code.AppImage" ) ,
187- "/home/alice/bin/t3code.AppImage" ,
188- ) ;
189- assert . equal (
190- DesktopLinuxUrlHandler . escapeDesktopEntryExecArgument ( "/opt/T3(beta)/t3code.AppImage" ) ,
191- '"/opt/T3(beta)/t3code.AppImage"' ,
192- ) ;
193- assert . equal (
194- DesktopLinuxUrlHandler . escapeDesktopEntryExecArgument ( "/opt/t3~old/t3code.AppImage" ) ,
195- '"/opt/t3~old/t3code.AppImage"' ,
196- ) ;
197- // A percent sign is not reserved, but must still be doubled (field codes).
198- assert . equal (
199- DesktopLinuxUrlHandler . escapeDesktopEntryExecArgument ( "/opt/t3%20code/t3code.AppImage" ) ,
200- "/opt/t3%%20code/t3code.AppImage" ,
201- ) ;
182+ it . each ( [
183+ {
184+ execTarget : "/opt/T3(beta)/t3code.AppImage" ,
185+ execLine : 'Exec="/opt/T3(beta)/t3code.AppImage" %U' ,
186+ } ,
187+ {
188+ execTarget : "/opt/t3%20code/t3code.AppImage" ,
189+ execLine : "Exec=/opt/t3%%20code/t3code.AppImage %U" ,
190+ } ,
191+ ] ) ( "renders the handler Exec line for $execTarget" , ( { execTarget, execLine } ) => {
192+ const entry = DesktopLinuxUrlHandler . renderUrlHandlerDesktopEntry ( {
193+ displayName : "T3 Code" ,
194+ execTarget,
195+ scheme : "t3code" ,
196+ } ) ;
197+
198+ assert . include ( entry . split ( "\n" ) , execLine ) ;
202199 } ) ;
203200
204201 it ( "carries structured context on registration errors" , ( ) => {
@@ -269,7 +266,12 @@ describe("DesktopLinuxUrlHandler", () => {
269266
270267 assert . include (
271268 recorded . files [ 0 ] ?. content ,
272- `Exec=${ DesktopLinuxUrlHandler . escapeDesktopEntryExecArgument ( process . execPath ) } %U` ,
269+ DesktopLinuxUrlHandler . renderUrlHandlerDesktopEntry ( {
270+ displayName : "T3 Code (Alpha)" ,
271+ execTarget : process . execPath ,
272+ scheme : "t3code" ,
273+ iconPath : "/home/alice/.local/share/icons/com.t3tools.T3Code.desktop.png" ,
274+ } ) ,
273275 ) ;
274276 } ) ;
275277 } ) ;
0 commit comments