Screw.Unit tests not displaying properly in IE

The Screw.Unit JavaScript BDD framework is awesome, I love it.  Unfortunately if you grab the current head from github, it comes down with jQuery 1.2.6.  Using 1.2.6 with Screw.Unit and trying to run your tests in IE will result in something like this:

image

when it should look like this:

image

Simply upgrade from jQuery 1.2.6 to 1.4.1 and the problem will go away:

image


Posted by: Jeff
Posted on: 2/19/2010 at 8:07 PM
Categories: jQuery | Testing
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

BDD renaming macro with VB.net support

UPDATED: The code below has been replaced on 2/5/2010.  The previous code wasn't working too well in in 2008 when the case of "public sub" changed to "Public Sub". An additional change, if the text on the line does not contain double quotes, the method will exit without changing your code.

The BDD renaming macro from Jean-Paul Boodhoo really reduces the friction in typing BDD style test names. I can't tell you how much I despise hitting _ so much.  Anyways, since I work in VB.Net and well as C#, I had to add VB.net support to the macro.  Just map this to a hotkey (I use Ctrl+Alt+-), and you're set. Why is this important? It's important because you can generally type "Should return 0 when the input parameter is 0" much faster than Should_return_0_when_the_input_parameter_is_0.

In C#, this:

public void "Throws an exception with invalid input"()
changes to
public void Throws_an_exception_with_invalid_input()
and in VB:
Public Sub "Throws an exception with invalid input"()

changes to

Public Sub Throws_an_exception_with_invalid_input()
 
 
The Code:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module CodeEditor
    Sub ReplaceSpacesInTestNameWithUnderscores()
        If DTE.ActiveDocument Is Nothing Then Return

        Dim selection As TextSelection = CType(DTE.ActiveDocument.Selection(), EnvDTE.TextSelection)
        selection.SelectLine()
        If selection.Text = "" Then Return

        Dim prefix As String = "public void "
        Dim index As Integer = selection.Text.IndexOf(prefix)

        If index = -1 Then
            prefix = "public sub "
            index = selection.Text.IndexOf(prefix, System.StringComparison.CurrentCultureIgnoreCase)
            If index = -1 Then
                MsgBox("Could not find method identifier")
                Return
            End If
            prefix = selection.Text.Substring(index, prefix.Length)
        End If

        prefix = selection.Text.Substring(0, index) + prefix

        Dim description As String = selection.Text.Replace(prefix, String.Empty)

        If description.IndexOf("""") = -1 Then
            selection.EndOfLine()
            Return
        End If

        selection.Text = prefix + description.Replace(" ", "_").Replace("'", "_").Replace("""", "")
        selection.LineDown()
        selection.EndOfLine()
    End Sub
End Module

Posted by: Jeff
Posted on: 2/3/2010 at 1:21 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed