From c85e052555fea54e9b675a1ccbd22a7ba1407d41 Mon Sep 17 00:00:00 2001 From: Julien Bouvet Date: Sat, 22 Jul 2017 09:47:27 +0200 Subject: [PATCH] Adding failing test as per issue #1 --- test/expected/font-face.css | 10 ++++++++++ test/fixtures/font-face.css | 17 +++++++++++++++++ test/main.js | 8 ++++++++ 3 files changed, 35 insertions(+) create mode 100644 test/expected/font-face.css create mode 100644 test/fixtures/font-face.css diff --git a/test/expected/font-face.css b/test/expected/font-face.css new file mode 100644 index 0000000..b9965b7 --- /dev/null +++ b/test/expected/font-face.css @@ -0,0 +1,10 @@ + +@media screen { + a { + color: blue !important; + background: red; + } + @font-face { + font-family: 'Arial2'; + } +} diff --git a/test/fixtures/font-face.css b/test/fixtures/font-face.css new file mode 100644 index 0000000..d7d8010 --- /dev/null +++ b/test/fixtures/font-face.css @@ -0,0 +1,17 @@ +/* +* Following issue#1 +* Test case for nested font-face within a media-query +*/ + +@media screen { + a { + color: blue !important; + background: red; + } + @font-face { + font-family: 'Arial2'; + } +} +@font-face { + font-family: 'Tahoma2'; +} diff --git a/test/main.js b/test/main.js index 0e88c83..ad693bd 100644 --- a/test/main.js +++ b/test/main.js @@ -14,3 +14,11 @@ describe('mediaquery-text', function() { done(); }); }); + +describe('mediaquery-text', function() { + it('Should return Media Query containing a font-face rule', function(done) { + var mediaQueries = mediaQueryText(String(fs.readFileSync(path.join('test', 'fixtures', 'font-face.css')))); + mediaQueries.should.be.equal(String(fs.readFileSync(path.join('test', 'expected', 'font-face.css')))); + done(); + }); +});