Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
code review comments. change haxe to erlang due to #2968.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsanjose committed Feb 27, 2013
1 parent 81aa896 commit 9e2c4e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/language/LanguageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ define(function (require, exports, module) {
var mode = definition.mode;
if (mode) {
language._setMode(mode);
} else {
language._modeReady.reject();
}

return language;
Expand Down
20 changes: 12 additions & 8 deletions test/spec/LanguageManager-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
* Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
Expand All @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, describe, CodeMirror, jasmine, beforeEach, afterEach, it, xit, runs, waitsFor, expect, waitsForDone */
/*global define, $, describe, CodeMirror, jasmine, beforeEach, afterEach, it, runs, waitsFor, expect, waitsForDone, waitsForFail */

define(function (require, exports, module) {
'use strict';
Expand Down Expand Up @@ -76,7 +76,11 @@ define(function (require, exports, module) {
}

// using async waitsFor is ok if it's the last block in a spec
waitsForDone(actual.modeReady, '"' + expected.mode + '" mode loading', 10000);
if (expected.mode) {
waitsForDone(actual.modeReady, '"' + expected.mode + '" mode loading', 10000);
} else {
waitsForFail(actual.modeReady, '"' + expected.mode + '" should not load', 10000);
}
}

describe("built-in languages", function () {
Expand Down Expand Up @@ -126,7 +130,7 @@ define(function (require, exports, module) {

describe("defineLanguage", function () {

xit("should create a basic language", function () {
it("should create a basic language", function () {
var def = { id: "one", name: "One" },
lang = defineLanguage(def);

Expand Down Expand Up @@ -197,16 +201,16 @@ define(function (require, exports, module) {
});

it("should load a built-in CodeMirror mode", function () {
var id = "haxe";
var id = "erlang";

runs(function () {
// haxe is not defined in the default set of languages in languages.json
// erlang is not defined in the default set of languages in languages.json
expect(CodeMirror.modes[id]).toBe(undefined);

var def = { id: id, name: "HaXe", fileExtensions: ["haxe"], mode: "haxe" },
var def = { id: id, name: "erlang", fileExtensions: ["erlang"], mode: "erlang" },
lang = defineLanguage(def);

expect(LanguageManager.getLanguageForFileExtension("file.haxe")).toBe(lang);
expect(LanguageManager.getLanguageForFileExtension("file.erlang")).toBe(lang);

validateLanguage(def, lang);
});
Expand Down

0 comments on commit 9e2c4e7

Please sign in to comment.