Skip to content

Commit

Permalink
feat(icon): initial md-icon implementation (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
dozingcat authored and jelbourn committed Apr 23, 2016
1 parent f8c8ae6 commit a094a33
Show file tree
Hide file tree
Showing 17 changed files with 1,255 additions and 2 deletions.
58 changes: 58 additions & 0 deletions src/components/icon/fake-svgs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {
Response,
ResponseOptions} from 'angular2/http';

/**
* Fake URLs and associated SVG documents used by tests.
*/
const FAKE_SVGS = (() => {
const svgs = new Map<string, string>();
svgs.set('cat.svg',
'<svg><path id="meow"></path></svg>');

svgs.set('dog.svg',
'<svg><path id="woof"></path></svg>');

svgs.set('farm-set-1.svg', `
<svg>
<defs>
<g id="pig"><path id="oink"></path></g>
<g id="cow"><path id="moo"></path></g>
</defs>
</svg>
`);

svgs.set('farm-set-2.svg', `
<svg>
<defs>
<g id="cow"><path id="moo moo"></path></g>
<g id="sheep"><path id="baa"></path></g>
</defs>
</svg>
`);

svgs.set('arrow-set.svg', `
<svg>
<defs>
<svg id="left-arrow"><path id="left"></path></svg>
<svg id="right-arrow"><path id="right"></path></svg>
</defs>
</svg>
`);

return svgs;
})();

/**
* Returns an HTTP response for a fake SVG URL.
*/
export function getFakeSvgHttpResponse(url: string) {
if (FAKE_SVGS.has(url)) {
return new Response(new ResponseOptions({
status: 200,
body: FAKE_SVGS.get(url),
}));
} else {
return new Response(new ResponseOptions({status: 404}));
}
}
Loading

0 comments on commit a094a33

Please sign in to comment.