ruby - How does Domino deal with a dashed class name -
i'm attempting create , use domino abstract login page
describe :index, :type => :request before visit '/' blah_email_login('user1') end ... def blah_email_login(user) dom::email_link.find_by_name 'mail'.click .... end module dom class email_link < domino selector 'a' attribute :tab-label end
here html
<a class="tab-label fz-xs accent " href="https://mail.blah.com/..." id="blah"><span class="tab-icon img-sprite"></span><em class="strong tab-link-txt y-link-1 " title="mail">mail</em></a>
the process cannot take dash indicated error pre run
c:\blah.rb:93:in `<class:email_link>': undefined local variable or method `label' dom::email_link:class (nameerror)
when attempted alter attribute to
attribute :'tab-label'
i got ...
c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/domino-0.5.0/lib/domino.rb:114:in `class_eval': (eval):2: syntax error, unexpected '-', expecting ';' or '\n' (syntaxerror) def tab-label ^
when included escape characters
attribute :'tab\-label'
i got ...
c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/domino-0.5.0/lib/domino.rb:114:in `class_eval': (eval):2: syntax error, unexpected $undefined, expecting ';' or '\n' (syntaxerror) def tab\-label ^ (eval):4: syntax error, unexpected $undefined, expecting ']' if value && self.class.callbacks[:tab\-label].is_a?(proc)
the site i'm working has many dashed class names, ideas on how work that?
try:
module dom class email_link < domino selector 'a' attribute :'tab-label' end
update
domino's default behavior replace _
in attribute names -
in class names (see here).
therefore attribute name should use underscore:
module dom class email_link < domino selector 'a' attribute :tab_label end
Comments
Post a Comment