mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-30 14:01:02 +00:00 
			
		
		
		
	Adds a feature similar to this https://github.blog/changelog/2021-11-24-specify-theme-context-for-images-in-markdown/ , by adding styles to elements which `src` or `href` attribute ends with `#light-mode-only` or `#dark-mode-only`. To improve compability, the github variants with the `gh-` prefix are also contained. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3985 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org> Co-committed-by: Mai-Lapyst <mai-lapyst@noreply.codeberg.org>
		
			
				
	
	
		
			13 lines
		
	
	
	
		
			583 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
	
		
			583 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // @ts-check
 | |
| import {test, expect} from '@playwright/test';
 | |
| 
 | |
| test('Test markup with #xyz-mode-only', async ({page}) => {
 | |
|   const response = await page.goto('/user2/repo1/issues/1');
 | |
|   await expect(response?.status()).toBe(200);
 | |
|   await page.waitForLoadState('networkidle');
 | |
| 
 | |
|   const comment = page.locator('.comment-body>.markup', {hasText: 'test markup light/dark-mode-only'});
 | |
|   await expect(comment).toBeVisible();
 | |
|   await expect(comment.locator('[src$="#gh-light-mode-only"]')).toBeVisible();
 | |
|   await expect(comment.locator('[src$="#gh-dark-mode-only"]')).not.toBeVisible();
 | |
| });
 |