Chris@0: enableViewsTestModule(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests for incorrectly escaped markup in the views-view-fields.html.twig. Chris@0: */ Chris@0: public function testViewsViewFieldsEscaping() { Chris@0: // Test with system theme using theme function. Chris@0: $this->drupalGet('test_page_display_200'); Chris@0: Chris@0: // Assert that there are no escaped '<'s characters. Chris@0: $this->assertNoEscaped('<'); Chris@0: Chris@0: // Install theme to test with template system. Chris@0: \Drupal::service('theme_handler')->install(['views_test_theme']); Chris@0: Chris@0: // Make base theme default then test for hook invocations. Chris@0: $this->config('system.theme') Chris@0: ->set('default', 'views_test_theme') Chris@0: ->save(); Chris@0: $this->assertEqual($this->config('system.theme')->get('default'), 'views_test_theme'); Chris@0: Chris@0: $this->drupalGet('test_page_display_200'); Chris@0: Chris@0: // Assert that we are using the correct template. Chris@0: $this->assertText('force', 'The force is strong with this one'); Chris@0: Chris@0: // Assert that there are no escaped '<'s characters. Chris@0: $this->assertNoEscaped('<'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Tests for incorrectly escaped markup in a header label on a display table. Chris@0: */ Chris@0: public function testViewsFieldHeaderEscaping() { Chris@0: // Test with a field header label having an html element wrapper. Chris@0: $this->drupalGet('test_field_header'); Chris@0: Chris@0: // Assert that there are no escaped '<'s characters. Chris@0: $this->assertNoEscaped('<'); Chris@0: Chris@0: // Test with a field header label having a XSS test as a wrapper. Chris@0: $this->drupalGet('test_field_header_xss'); Chris@0: Chris@0: // Assert that XSS test is escaped. Chris@0: $this->assertNoRaw('', 'Harmful tags are escaped in header label.'); Chris@0: } Chris@0: Chris@0: }