Commit ce3867fa authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Correct JavaScript syntax in all Aggregator tests.

This way when we switch to full JavaScript parser, the tests won't
fail because of syntax errors.
parent 8a702e25
Loading
Loading
Loading
Loading
+21 −20
Original line number Diff line number Diff line
@@ -74,11 +74,11 @@ describe JsDuck::Aggregator do
  describe "implicit @cfg" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg
         * Some documentation.
         */
        foo: "asdf"
        foo: "asdf" })
      EOS
    end
    it_should_behave_like "cfg"
@@ -89,10 +89,10 @@ describe JsDuck::Aggregator do
  describe "implicit @property" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * Some documentation.
         */
        foo: "asdf"
        foo: "asdf" })
      EOS
    end
    it_should_behave_like "property"
@@ -103,11 +103,11 @@ describe JsDuck::Aggregator do
  describe "typeless @cfg" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg
         * Some documentation.
         */
        foo: func(),
        foo: func() })
      EOS
    end
    it_should_behave_like "cfg"
@@ -118,11 +118,11 @@ describe JsDuck::Aggregator do
  describe "typeless @property" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @property
         * Some documentation.
         */
        foo: func(),
        foo: func() })
      EOS
    end
    it_should_behave_like "property"
@@ -147,10 +147,10 @@ describe JsDuck::Aggregator do
  describe "@cfg with uppercase name" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg {String} Foo
         */
        Foo: 12
        Foo: 12 })
      EOS
    end
    it_should_behave_like "cfg"
@@ -159,11 +159,11 @@ describe JsDuck::Aggregator do
  describe "@cfg with uppercase name after description" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * Docs here
         * @cfg {String} Foo
         */
        Foo: 12
        Foo: 12 })
      EOS
    end
    it_should_behave_like "cfg"
@@ -177,7 +177,7 @@ describe JsDuck::Aggregator do

  describe "@property with number in code" do
    before do
      @doc = parse("/** @property */ foo: 123")[0]
      @doc = parse("({ /** @property */ foo: 123 })")[0]
      @type = "Number"
    end
    it_should_behave_like "auto type"
@@ -185,7 +185,7 @@ describe JsDuck::Aggregator do

  describe "@property with regex in code" do
    before do
      @doc = parse("/** @property */ foo: /foo/i")[0]
      @doc = parse("({ /** @property */ foo: /foo/i })")[0]
      @type = "RegExp"
    end
    it_should_behave_like "auto type"
@@ -193,7 +193,7 @@ describe JsDuck::Aggregator do

  describe "@property with true in code" do
    before do
      @doc = parse("/** @property */ foo: true")[0]
      @doc = parse("({ /** @property */ foo: true })")[0]
      @type = "Boolean"
    end
    it_should_behave_like "auto type"
@@ -201,7 +201,7 @@ describe JsDuck::Aggregator do

  describe "@property with false in code" do
    before do
      @doc = parse("/** @property */ foo: false")[0]
      @doc = parse("({ /** @property */ foo: false })")[0]
      @type = "Boolean"
    end
    it_should_behave_like "auto type"
@@ -241,11 +241,11 @@ describe JsDuck::Aggregator do
  describe "@type without @property" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @type String
         * Some documentation.
         */
        MY_CONSTANT: true,
        MY_CONSTANT: true })
      EOS
    end
    it_should_behave_like "property"
@@ -262,7 +262,7 @@ describe JsDuck::Aggregator do
         * @property
         * Some documentation.
         */
        this.foo = "";
        this.foo = ""
      EOS
    end
    it_should_behave_like "property"
@@ -273,10 +273,11 @@ describe JsDuck::Aggregator do
  describe "comma-first style" do
    before do
      @doc = parse(<<-EOS)[0]
      ({ blah: 100
        /**
         * Some documentation.
         */
        ,foo: ""
        ,foo: "" })
      EOS
    end
    it_should_behave_like "property"
+27 −27
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ describe JsDuck::Aggregator do
        /**
         * @param {Number} foo (optional) Something
         */
        function foo() {
        function foo() {}
      EOS
    end
    it_should_behave_like "optional parameter"
@@ -41,7 +41,7 @@ describe JsDuck::Aggregator do
        /**
         * @param {Number} foo (Optional) Something
         */
        function foo() {
        function foo() {}
      EOS
    end
    it_should_behave_like "optional parameter"
@@ -53,7 +53,7 @@ describe JsDuck::Aggregator do
        /**
         * @param {Number} foo optional Something
         */
        function foo() {
        function foo() {}
      EOS
    end
    it "doesn't make parameter optional" do
@@ -67,7 +67,7 @@ describe JsDuck::Aggregator do
        /**
         * @param {Number} foo Something (optional)
         */
        function foo() {
        function foo() {}
      EOS
    end
    it "doesn't make parameter optional" do
@@ -81,7 +81,7 @@ describe JsDuck::Aggregator do
        /**
         * @param {Number} [foo] Something
         */
        function foo() {
        function foo() {}
      EOS
    end
    it_should_behave_like "optional parameter"
@@ -93,7 +93,7 @@ describe JsDuck::Aggregator do
        /**
         * @param {Number} [foo=42] Something
         */
        function foo() {
        function foo() {}
      EOS
    end
    it_should_behave_like "optional parameter"
@@ -108,7 +108,7 @@ describe JsDuck::Aggregator do
        /**
         * @param {Number} [foo="Hello, my [dear]!"] Something
         */
        function foo() {
        function foo() {}
      EOS
    end
    it_should_behave_like "optional parameter"
@@ -263,10 +263,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit default value" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg foo Something
         */
        foo: 18
        foo: 18 })
      EOS
    end
    it "detects the default value" do
@@ -277,10 +277,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit default string value" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg foo Something
         */
        foo: "Hello"
        foo: "Hello" })
      EOS
    end
    it "detects the default value" do
@@ -291,10 +291,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit default regex value" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg foo Something
         */
        foo: /[a-z]/
        foo: /[a-z]/ })
      EOS
    end
    it "detects the default value" do
@@ -305,10 +305,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit default array value" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg foo Something
         */
        foo: [1, 2, 3]
        foo: [1, 2, 3] })
      EOS
    end
    it "detects the default value" do
@@ -319,10 +319,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit default object value" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg foo Something
         */
        foo: {foo: 3, bar: "2"}
        foo: {foo: 3, bar: "2"} })
      EOS
    end
    it "detects the default value" do
@@ -333,10 +333,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit string value starting with Ext.baseCSSPrefix" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg foo Something
         */
        foo: Ext.baseCSSPrefix + "foo"
        foo: Ext.baseCSSPrefix + "foo" })
      EOS
    end
    it "replaces Ext.baseCSSPrefix with 'x-'" do
@@ -347,10 +347,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit number value given as expression" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg {Number} foo
         */
        foo: 5 + 5
        foo: 5 + 5 })
      EOS
    end
    it "doesn't get the default value from code" do
@@ -361,10 +361,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit array value with chained method" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg {Array} foo
         */
        foo: [1, 2, 3].compact()
        foo: [1, 2, 3].compact() })
      EOS
    end
    it "doesn't get the default value from code" do
@@ -375,10 +375,10 @@ describe JsDuck::Aggregator do
  describe "cfg with implicit name followed by code field with another name" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg foo
         */
        bar: true
        bar: true })
      EOS
    end
    it "doesn't get the default value from code" do
@@ -392,10 +392,10 @@ describe JsDuck::Aggregator do
  describe "cfg without implicit name followed by code" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @cfg
         */
        bar: true
        bar: true })
      EOS
    end
    it "gets default value from code" do
+7 −7
Original line number Diff line number Diff line
@@ -111,14 +111,14 @@ describe JsDuck::Aggregator do

  describe "function-literal in object-literal" do
    before do
      @doc = parse("/** Some function */ foo: function() {}")[0]
      @doc = parse("({ /** Some function */ foo: function() {} })")[0]
    end
    it_should_behave_like "method documentation"
  end

  describe "function-literal in object-literal-string" do
    before do
      @doc = parse("/** Some function */ 'foo': function() {}")[0]
      @doc = parse("({ /** Some function */ 'foo': function() {} })")[0]
    end
    it_should_behave_like "method documentation"
  end
@@ -132,21 +132,21 @@ describe JsDuck::Aggregator do

  describe "function-literal in comma-first style" do
    before do
      @doc = parse("/** Some function */ , foo: function() {}")[0]
      @doc = parse("({ blah: 7 /** Some function */ , foo: function() {} })")[0]
    end
    it_should_behave_like "method documentation"
  end

  describe "Ext.emptyFn in object-literal" do
    before do
      @doc = parse("/** Some function */ foo: Ext.emptyFn")[0]
      @doc = parse("({ /** Some function */ foo: Ext.emptyFn })")[0]
    end
    it_should_behave_like "method documentation"
  end

  describe "anonymous function" do
    before do
      @doc = parse("/** Some function */ function() {}")[0]
      @doc = parse("( /** Some function */ function() {} )")[0]
    end

    it "detects method" do
@@ -398,11 +398,11 @@ describe JsDuck::Aggregator do
  describe "implicit event name as object property" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
      ({/**
         * @event
         * Fires when needed.
         */
        mousedown: true,
        mousedown: true })
      EOS
    end
    it_should_behave_like "event documentation"