-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(config): Allow custom context and debug files, with feature test…
… and some specs.
- Loading branch information
Showing
9 changed files
with
121 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Feature: Custom Context File | ||
In order to use Karma | ||
As a person who wants to write great tests | ||
I want Karma to use a custom context file | ||
|
||
Scenario: Custom context.html file | ||
Given a configuration with: | ||
""" | ||
files = ['context/*.js']; | ||
browsers = ['PhantomJS']; | ||
plugins = [ | ||
'karma-jasmine', | ||
'karma-phantomjs-launcher' | ||
]; | ||
customContextFile = 'context/context2.html' | ||
""" | ||
When I start Karma | ||
Then it passes with: | ||
""" | ||
. | ||
PhantomJS | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
This is the execution context. | ||
Loaded within the iframe. | ||
Reloaded before every execution run. | ||
--> | ||
<html> | ||
<head> | ||
<title></title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> | ||
</head> | ||
<body> | ||
<!-- The scripts need to be in the body DOM element, as some test running frameworks need the body | ||
to have already been created so they can insert their magic into it. For example, if loaded | ||
before body, Angular Scenario test framework fails to find the body and crashes and burns in | ||
an epic manner. --> | ||
<div id="custom-context"></div> | ||
<script type="text/javascript"> | ||
// sets window.__karma__ and overrides console and error handling | ||
// Use window.opener if this was opened by someone else - in a new window | ||
if (window.opener) { | ||
window.opener.karma.setupContext(window); | ||
} else { | ||
window.parent.karma.setupContext(window); | ||
} | ||
|
||
// All served files with the latest timestamps | ||
%MAPPINGS% | ||
</script> | ||
<!-- Dynamically replaced with <script> tags --> | ||
%SCRIPTS% | ||
<script type="text/javascript"> | ||
window.__karma__.loaded(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('custom context file', function () { | ||
it('should be able to find custom DOM elements', function () { | ||
expect(document.querySelector('#custom-context') == null).toBe(false) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters