| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  | const practiceProjects = [ | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Accessibility Quiz', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-accessibility-by-building-a-quiz/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Cafe Menu', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-basic-css-by-building-a-cafe-menu/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Ferris Wheel', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-css-animation-by-building-a-ferris-wheel/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Colored Markers', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-css-colors-by-building-a-set-of-colored-markers/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Photo Gallery', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-css-flexbox-by-building-a-photo-gallery/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Magazine', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-css-grid-by-building-a-magazine/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Penguin', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-css-transforms-by-building-a-penguin/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'City Skyline', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-css-variables-by-building-a-city-skyline/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     title: 'CatPhotoApp', | 
					
						
							|  |  |  |     url: '/learn/2022/responsive-web-design/learn-html-by-building-a-cat-photo-app/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Registration Form', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-html-forms-by-building-a-registration-form/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Picasso Painting', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-intermediate-css-by-building-a-picasso-painting/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Balance Sheet', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-more-about-css-pseudo-selectors-by-building-a-balance-sheet/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Piano', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-responsive-web-design-by-building-a-piano/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2022-03-14 15:54:43 +00:00
										 |  |  |     title: 'Rothko Painting', | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |     url: '/learn/2022/responsive-web-design/learn-the-css-box-model-by-building-a-rothko-painting/' | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     title: 'Nutrition Label', | 
					
						
							|  |  |  |     url: '/learn/2022/responsive-web-design/learn-typography-by-building-a-nutrition-label/' | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-11-29 19:30:28 +01:00
										 |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const legacyFirstChallengeUrls = [ | 
					
						
							|  |  |  |   '/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements', | 
					
						
							|  |  |  |   '/learn/responsive-web-design/basic-css/change-the-color-of-text', | 
					
						
							|  |  |  |   '/learn/responsive-web-design/applied-visual-design/create-visual-balance-using-the-text-align-property', | 
					
						
							|  |  |  |   '/learn/responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility', | 
					
						
							|  |  |  |   '/learn/responsive-web-design/css-flexbox/use-display-flex-to-position-two-boxes', | 
					
						
							|  |  |  |   '/learn/responsive-web-design/css-grid/create-your-first-css-grid' | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('project preview', () => { | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |   it('should appear on the first challenges of each practice project', () => { | 
					
						
							|  |  |  |     practiceProjects.forEach(({ url, title }) => { | 
					
						
							|  |  |  |       cy.visit(url + 'step-1'); | 
					
						
							|  |  |  |       cy.contains("Here's a preview of what you will build"); | 
					
						
							|  |  |  |       cy.get('[data-cy="project-preview-modal"]') | 
					
						
							|  |  |  |         .should('be.focused') | 
					
						
							|  |  |  |         .find('iframe') | 
					
						
							|  |  |  |         .should('have.attr', 'title', title + ' preview'); | 
					
						
							| 
									
										
										
										
											2021-11-29 19:30:28 +01:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2021-11-29 19:30:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |   // Tests for the absence of an element are tricky, if, as is the case here,
 | 
					
						
							|  |  |  |   // the element is not rendered straight away. So, instead, we test for a
 | 
					
						
							|  |  |  |   // side effect of not showing the modal: an editor is allowed to get focus.
 | 
					
						
							|  |  |  |   it('should NOT appear on the second challenges of each practice project', () => { | 
					
						
							|  |  |  |     practiceProjects.forEach(({ url }) => { | 
					
						
							|  |  |  |       cy.visit(url + 'step-2'); | 
					
						
							|  |  |  |       cy.focused() | 
					
						
							|  |  |  |         .parents() | 
					
						
							|  |  |  |         .should('have.class', 'react-monaco-editor-container'); | 
					
						
							| 
									
										
										
										
											2021-11-29 19:30:28 +01:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2022-02-10 18:57:50 +01:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2021-11-29 19:30:28 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   it('should NOT appear on the first challenges of legacy blocks', () => { | 
					
						
							|  |  |  |     legacyFirstChallengeUrls.forEach(url => { | 
					
						
							|  |  |  |       cy.visit(url); | 
					
						
							|  |  |  |       // if no modals are showing, then the editor should have focus:
 | 
					
						
							|  |  |  |       cy.focused() | 
					
						
							|  |  |  |         .parents() | 
					
						
							|  |  |  |         .should('have.class', 'react-monaco-editor-container'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |