tags:

views:

403

answers:

1

I would like to be able to add coloured backgrounds to FitNesse table cells (sometimes entire rows) to enhance their readability. I'm happy if these colours are overwritten when a test page is run. Is there a way to do this?

+1  A: 

You can apply custom styles to any fitnesse cell by using the

!style_(text)

widgit. Where (text) is the name of some css class you have defined. You can see the various options for formatting the fitnesse wiki pages at fitnesse.org

EDIT : It looks as though the style widgit is only useful for formatting text not in a fixture table. For example:

!|Store Data Dictionary Table|VALUE_SET_VALUE|
|!style_strike(ValueSetID)|Code|Label|
|MCODESET|1|RESPONSE1|
|MCODESET|2|RESPONSE2|
|MCODESET|3|RESPONSE3|
|MCODESET|4|RESPONSE4|

does not set the style of ValueSetId to the strike class. But removing the ! from the table itself like so does work:

|Store Data Dictionary Table|VALUE_SET_VALUE|
|!style_strike(ValueSetID)|Code|Label|
|MCODESET|1|RESPONSE1|
|MCODESET|2|RESPONSE2|
|MCODESET|3|RESPONSE3|
|MCODESET|4|RESPONSE4|

You could also try applying the style directly like so:

!|Store Data Dictionary Table|VALUE_SET_VALUE|
|!-<span class="strike">ValueSetID</span>-!|Code|Label|
|MCODESET|1|RESPONSE1|
|MCODESET|2|RESPONSE2|
|MCODESET|3|RESPONSE3|
|MCODESET|4|RESPONSE4|

This uses the widgit that outputs the HTML tags. I tried applying it to the row but it did not work though :( You might have to tag each individual element.

Jeffrey Cameron
Ideally I'd like to be able to color the background of the cell rather than specific pieces of text. In particular I want to be able to highlight a whole row. Can I use !style for this too?
Matthew Murdoch
I've tried various permutations, but I'm not having any luck. The documentation you refer to says 'The style of text will be the CSS class <someStyle>' which suggests that 'text' is not the style name but the data you want to be styled. Could you include an example, please?
Matthew Murdoch
See my comment Matthew. I agree the documentation is confusing. I really wish UncleBob would put some time into making Fitnesse useful rather than developing Slim (which does mostly the same stuff as fitnesse just with a different backend).
Jeffrey Cameron
Happy to help, sorry for the delayed response!
Jeffrey Cameron