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

Allow aliases to contain any characters.

Previously only word-characters were permitted, resulting in alias being
ignored.
parent bcba8a6a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ module JsDuck
    # it instead of creating a new hash.
    def build_aliases_hash(aliases, hash={})
      aliases.each do |a|
        if a =~ /^([\w.]+)\.(\w+)$/
        if a =~ /^(.+)\.([^.]+)$/
          if hash[$1]
            hash[$1] << $2
          else
+14 −0
Original line number Diff line number Diff line
@@ -223,6 +223,20 @@ describe JsDuck::Aggregator do
    end
  end

  describe "Ext.define() with dash inside alias name" do
    before do
      @doc = parse(<<-EOS)[0]
        /** */
        Ext.define('MyClass', {
          alias: 'widget.foo-bar'
        });
      EOS
    end
    it "treats dash as a normal character" do
      @doc[:aliases].should == {"widget" => ["foo-bar"]}
    end
  end

  describe "Ext.define() with xtype property" do
    before do
      @doc = parse(<<-EOS)[0]