Skip to content

Commit 7a83d54

Browse files
committed
working on value test for #1
1 parent 7434843 commit 7a83d54

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ it('works', () => {
3535

3636
### Basic example
3737

38-
See [cypress/integration/basic.js](cypress/integration/basic.js)
38+
See [cypress/integration/basic-spec.js](cypress/integration/basic-spec.js)
3939

4040
```js
4141
import {mount} from 'cypress-angularjs-unit-test'
File renamed without changes.

cypress/integration/value-spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference types="cypress" />
2+
import {mount} from '../..'
3+
import angular from 'angular'
4+
5+
it('has value', () => {
6+
angular.module('A', [])
7+
.value('foo', 'bar')
8+
mount(['A'])
9+
})

src/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
import angular from 'angular'
33

44
/* global cy */
5-
export const mount = (template, modules = []) => {
5+
export const mount = function (template, modules = []) {
6+
if (arguments.length === 1) {
7+
// test did not pass a template, just list of modules
8+
modules = template
9+
template = ''
10+
}
11+
612
const html = `
713
<head>
814
<meta charset="UTF-8">

0 commit comments

Comments
 (0)