Skip to content

Commit

Permalink
Merge pull request machty#2 from bantic/ember-cli-examplar-failing-tests
Browse files Browse the repository at this point in the history
Ember cli examplar failing tests
  • Loading branch information
mixonic committed Feb 18, 2015
2 parents 91eb5be + 8acf01f commit 5c2af62
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 143 deletions.
41 changes: 0 additions & 41 deletions tests/integration/hash-brace-syntax-test.js

This file was deleted.

25 changes: 0 additions & 25 deletions tests/integration/html-single-line-test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
/*global QUnit*/
import Emblem from '../../emblem';
import { w } from '../support/utils';

QUnit.module("html multiple lines");
QUnit.module("html: single line");

QUnit.test("element only", function(assert){
assert.compilesTo("p", "<p></p>");
});

QUnit.test("with text", function(assert){
assert.compilesTo("p Hello", "<p>Hello</p>");
});

QUnit.test("with more complex text", function(assert){
assert.compilesTo(
"p Hello, how's it going with you today?",
"<p>Hello, how's it going with you today?</p>"
);
});

QUnit.test("with trailing space", function(assert){
assert.compilesTo("p Hello ", "<p>Hello </p>");
});

QUnit.test("can start with angle bracket html", function(assert){
var emblem = "<span>Hello</span>";
assert.compilesTo(emblem, "<span>Hello</span>");
});

QUnit.module("html: multiple lines");

QUnit.test("two lines", function(assert){
var emblem = w(
Expand Down Expand Up @@ -31,8 +58,8 @@ QUnit.test("three lines w/ embedded html", function(assert){

QUnit.test("indentation doesn't need to match starting inline content's", function(assert){
var emblem = w(
"span Hello,",
" How are you?"
" span Hello,",
" How are you?"
);
assert.compilesTo(emblem, "<span>Hello, How are you?</span>");
});
Expand Down Expand Up @@ -84,7 +111,7 @@ QUnit.test("w/ mustaches", function(assert){
"<div><span>Hello, {{foo}} are you? Excellent.</span></div>");
});

// This test seems to test nonsense syntax
// FIXME: This test seems to test nonsense syntax ?
QUnit.test("w/ block mustaches", function(assert){
var emblem = w(
"p Hello, #{ sally | Hello},",
Expand Down Expand Up @@ -115,3 +142,38 @@ QUnit.test("can start with angle bracket html and go to multiple lines", functio
);
assert.compilesTo(emblem, "<span>Hello dude,\nwhat's up?</span>");
});

QUnit.module("html: nested");

test("basic", function(assert){
var emblem = w(
"p",
" span Hello",
" strong Hi",
"div",
" p Hooray"
);
assert.compilesTo(emblem,
'<p><span>Hello</span><strong>Hi</strong></p><div><p>Hooray</p></div>');
});

test("empty nest", function(assert){
var emblem = w(
"p",
" span",
" strong",
" i"
);
assert.compilesTo(emblem, '<p><span><strong><i></i></strong></span></p>');
});

test("empty nest w/ attribute shorthand", function(assert){
var emblem = w(
"p.woo",
" span#yes",
" strong.no.yes",
" i"
);
assert.compilesTo(emblem,
'<p class="woo"><span id="yes"><strong class="no yes"><i></i></strong></span></p>');
});
34 changes: 0 additions & 34 deletions tests/integration/indentation-test.js

This file was deleted.

32 changes: 32 additions & 0 deletions tests/integration/mustaches-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,38 @@ test('hash stache in text line', function(assert){
assert.compilesTo(emblem, 'bork {{bar}}');
});

QUnit.module("mustache: hash brace syntax, #{}");

test('acts like {{}}', function(assert){
var emblem = "span Yo #{foo}, I herd.";
assert.compilesTo(emblem,
"<span>Yo {{foo}}, I herd.</span>");
});

test('can start inline content', function(assert){
var emblem = "span #{foo}, I herd.";
assert.compilesTo(emblem,
"<span>{{foo}}, I herd.</span>");
});

test('can end inline content', function(assert){
var emblem = "span I herd #{foo}";
assert.compilesTo(emblem,
"<span>I herd {{foo}}</span>");
});

test("doesn't screw up parsing when # used in text nodes", function(assert){
var emblem = "span OMG #YOLO";
assert.compilesTo(emblem,
"<span>OMG #YOLO</span>");
});

test("# can be only thing on line", function(assert){
var emblem = "span #";
assert.compilesTo(emblem,
"<span>#</span>");
});

/*
QUnit.module("mustache helpers");
Expand Down
36 changes: 0 additions & 36 deletions tests/integration/nested-html-test.js

This file was deleted.

38 changes: 35 additions & 3 deletions tests/integration/text-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*global QUnit*/

import { w } from '../support/utils';
import Emblem from '../emblem';

QUnit.module("text: inline block helper");

Expand All @@ -18,8 +19,8 @@ test("multiline", function(assert) {

test("more complicated", function(assert) {
var emblem;
emblem = "view SomeView borf=\"yes\" | Hello, \n How are you? \n Sup?";
assert.compilesTo(emblem, '{{#view SomeView borf="yes"}}Hello, \nHow are you? \nSup?{{/view}}');
emblem = "view SomeView borf=\"yes\" | Hello, How are you? Sup?";
assert.compilesTo(emblem, '{{#view SomeView borf="yes"}}Hello, How are you? Sup?{{/view}}');
});

QUnit.module("text: whitespace fussiness");
Expand All @@ -35,7 +36,6 @@ test("spaces after mustaches", function(assert){
"{{#each foo}}<p></p><span></span>{{/each}}");
});


QUnit.module("text: preprocessor");

QUnit.test("it strips out preceding whitespace", function(assert){
Expand Down Expand Up @@ -103,6 +103,38 @@ test("flatlina", function(assert) {
assert.compilesTo(emblem, '<p><span>This be some text</span><title>Basic HTML Sample Page</title></p>');
});

QUnit.module("text: indentation");

test("it doesn't throw when indenting after a line with inline content", function(assert){
var emblem = w(
"p Hello",
" p invalid"
);
assert.compilesTo(emblem, "<p>Hello p invalid</p>");
});

test("it throws on half dedent", function(assert){
var emblem = w(
"p",
" span This is ok",
" span This aint"
);
assert.throws(function(){
Emblem.compile(emblem);
});
});

test("new indentation levels don't have to match parents'", function(assert){
var emblem = w(
"p ",
" span",
" div",
" span yes"
);
assert.compilesTo(emblem, "<p><span><div><span>yes</span></div></span></p>");
});


// FIXME maybe -- this test was commented out in the original test suite
/*
test("bigass", function(assert) {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/parser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ astTest('simple text', '| abc def ghi', function(assert, ast){
assert.deepEqual(ast, program([ text('abc def ghi') ]) );
});

// FIXME should this actually preserve the newline?
astTest('multiline text',
w('| abc def ghi',
' another line'), function(assert, ast){
Expand Down

0 comments on commit 5c2af62

Please sign in to comment.