Chris@0: drupalCreateNode([ Chris@0: 'promote' => NodeInterface::PROMOTED, Chris@0: ]); Chris@0: $user = $this->drupalCreateUser(); Chris@0: Chris@0: // Test frontpage. Chris@0: $this->drupalGet(''); Chris@0: $this->assertNoJavaScriptExceptHtml5Shiv(); Chris@0: Chris@0: // Test node page. Chris@0: $this->drupalGet('node/1'); Chris@0: $this->assertNoJavaScriptExceptHtml5Shiv(); Chris@0: Chris@0: // Test user profile page. Chris@0: $this->drupalGet('user/' . $user->id()); Chris@0: $this->assertNoJavaScriptExceptHtml5Shiv(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Passes if no JavaScript is found on the page except the HTML5 shiv. Chris@0: * Chris@0: * The HTML5 shiv is necessary for e.g. the
tag which Drupal 8 uses Chris@0: * to work in older browsers like Internet Explorer 8. Chris@0: */ Chris@0: protected function assertNoJavaScriptExceptHtml5Shiv() { Chris@0: // Ensure drupalSettings is not set. Chris@0: $settings = $this->getDrupalSettings(); Chris@0: $this->assertTrue(empty($settings), 'drupalSettings is not set.'); Chris@0: Chris@0: // Ensure the HTML5 shiv exists. Chris@0: $this->assertRaw('html5shiv/html5shiv.min.js', 'HTML5 shiv JavaScript exists.'); Chris@0: Chris@0: // Ensure no other JavaScript file exists on the page, while ignoring the Chris@0: // HTML5 shiv. Chris@0: $this->assertNoPattern('/(?