diff options
| author | Peter Bacon Darwin | 2014-02-12 22:47:42 +0000 |
|---|---|---|
| committer | Peter Bacon Darwin | 2014-02-16 19:03:41 +0000 |
| commit | 389d4879da4aa620ee95d789b19ff9be44eb730a (patch) | |
| tree | 93352ddc8738a975904a1774d51b93d585ca1075 /docs/spec/writerSpec.js | |
| parent | a564160511bf1bbed5a4fe5d2981fae1bb664eca (diff) | |
| download | angular.js-389d4879da4aa620ee95d789b19ff9be44eb730a.tar.bz2 | |
chore(doc-gen): new docs
chore(doc-gen): implement dgeni
Diffstat (limited to 'docs/spec/writerSpec.js')
| -rw-r--r-- | docs/spec/writerSpec.js | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/docs/spec/writerSpec.js b/docs/spec/writerSpec.js deleted file mode 100644 index 1c25078c..00000000 --- a/docs/spec/writerSpec.js +++ /dev/null @@ -1,64 +0,0 @@ -var writer, - rewire = require('rewire'); - -function mockResolvedPromise(resolvedValue) { - return { - then: function(success, failure) { - success(resolvedValue); - } - }; -} - -describe('writer', function() { - - beforeEach(function() { - writer = rewire('../src/writer.js'); - }); - - describe('toString', function() { - var toString; - - beforeEach(function() { - toString = writer.toString; - }); - - it('should merge string', function() { - expect(toString('abc')).toEqual('abc'); - }); - - it('should merge obj', function() { - expect(toString({a:1})).toEqual('{"a":1}'); - }); - - it('should merge array', function() { - expect(toString(['abc',{}])).toEqual('abc{}'); - }); - }); - - describe('replace method', function() { - var content, - replacements; - - beforeEach(function() { - content = 'angular super jQuery manifest'; - }); - - it('should replace placeholders', function() { - replacements = {'angular': 'ng', 'jQuery': 'jqlite','notHere': 'here'}; - - content = writer.replace(content, replacements); - expect(content).toBe('ng super jqlite manifest'); - }); - }); - - describe('copy', function() { - it('should call the transformation function', function() { - var readMock = jasmine.createSpy('readMock').andReturn(mockResolvedPromise('DUMMY CONTENT')); - writer.__set__("qfs.read", readMock); - var transformationFn = jasmine.createSpy('transformationFn'); - writer.copy('from', 'to', transformationFn, 'arg1', 'arg2'); - expect(readMock).toHaveBeenCalled(); - expect(transformationFn).toHaveBeenCalledWith('DUMMY CONTENT', 'arg1', 'arg2'); - }); - }); -}); |
