Like Jay said though you dont need the length test, and like charlie said 'this' will be undefined since you're working with a set not a distinct element. mcguiver's code will only work if the div and the text are exactly the same, not that it contains it.
Here is a line (combining jay and charlies comments) that will work for you:
- $('.SomeClass:contains("SomeText")').parent().addClass("NewClass");
This works because the selector returns all the matching elements, then you apply the parents method to find their parents, then add the class.
Hope that clears it up for you.
Dave