mirror of
				https://github.com/fooflington/selfdefined.git
				synced 2025-10-31 22:28:32 +00:00 
			
		
		
		
	 7aed7e3b90
			
		
	
	7aed7e3b90
	
	
	
		
			
			* Added avoid flag text to meta descriptions * Moved meta description logic to a shortcode * Fixing nunjucks syntax error in base template head Co-authored-by: Oscar <ovlb@users.noreply.github.com>
		
			
				
	
	
		
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import test from 'ava';
 | |
| 
 | |
| import metaDescriptionWithFlag from '../metaDescriptionWithFlag';
 | |
| 
 | |
| test('renders with flag.level = avoid and flag.text present', (t) => {
 | |
|   const flag = {
 | |
|     level: 'avoid',
 | |
|     text: 'ableist slur'
 | |
|   };
 | |
|   const preview = 'here is some preview text';
 | |
| 
 | |
|   t.is(
 | |
|     metaDescriptionWithFlag(preview, flag),
 | |
|     'Avoid: ableist slur. Here is some preview text'
 | |
|   );
 | |
| });
 | |
| 
 | |
| test('renders with flag.level = avoid and no flag.text', (t) => {
 | |
|   const flag = {
 | |
|     level: 'avoid'
 | |
|   };
 | |
|   const preview = 'here is some preview text';
 | |
| 
 | |
|   t.is(
 | |
|     metaDescriptionWithFlag(preview, flag),
 | |
|     'Avoid: here is some preview text'
 | |
|   );
 | |
| });
 | |
| 
 | |
| test('renders with flag.level != avoid', (t) => {
 | |
|   const flag = {
 | |
|     level: 'warning'
 | |
|   };
 | |
|   const preview = 'here is some preview text';
 | |
| 
 | |
|   t.is(metaDescriptionWithFlag(preview, flag), 'Here is some preview text');
 | |
| });
 | |
| 
 | |
| test('renders with no flag present', (t) => {
 | |
|   const preview = 'here is some preview text';
 | |
| 
 | |
|   t.is(metaDescriptionWithFlag(preview), 'Here is some preview text');
 | |
| });
 |