Browse Source

[cm6] Match uppercase file extensions in the include autocomplete (#14956)

GitOrigin-RevId: eb6898ef031dcc05f9fcb530fd4578ffda234a14
Alf Eaton 2 years ago
parent
commit
b3b31fb052

+ 1 - 1
services/web/frontend/js/features/source-editor/languages/latex/completions/include.ts

@@ -59,7 +59,7 @@ export function buildIncludeCompletions(
     }
 
     // TODO: a better list of graphics extensions?
-    if (/\.(eps|jpe?g|gif|png|tiff?|pdf|svg)$/.test(path)) {
+    if (/\.(eps|jpe?g|gif|png|tiff?|pdf|svg)$/i.test(path)) {
       // path parameter for \includegraphics{path}
       completions.graphics.push({
         type: 'file',

+ 6 - 2
services/web/test/frontend/features/source-editor/components/codemirror-editor-autocomplete.spec.tsx

@@ -54,6 +54,10 @@ describe('autocomplete', { scrollBehavior: false }, function () {
             _id: 'test-image-file',
             name: 'frog.jpg',
           },
+          {
+            _id: 'uppercase-extension-image-file',
+            name: 'frog.JPG',
+          },
         ],
       },
     ]
@@ -191,8 +195,8 @@ describe('autocomplete', { scrollBehavior: false }, function () {
       .type('{ctrl+ }')
 
     cy.findAllByRole('listbox').should('have.length', 1)
-    cy.findByRole('listbox').contains('frog.jpg').click()
-    activeEditorLine().should('have.text', '\\includegraphics[]{frog.jpg}')
+    cy.findByRole('listbox').contains('frog.JPG').click()
+    activeEditorLine().should('have.text', '\\includegraphics[]{frog.JPG}')
   })
 
   it('opens autocomplete on begin environment', function () {