01: /*
02: * Copyright 2007 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.user.client.ui;
17:
18: import com.google.gwt.junit.client.GWTTestCase;
19:
20: /**
21: * Tests the {@link NamedFrame} widget.
22: */
23: public class NamedFrameTest extends GWTTestCase {
24:
25: public String getModuleName() {
26: return "com.google.gwt.user.User";
27: }
28:
29: public void testNormalName() {
30: String name = "testFrame";
31: NamedFrame frame = new NamedFrame(name);
32: assertEquals(name, frame.getName());
33: }
34:
35: public void testEmptyName() {
36: try {
37: new NamedFrame("");
38: fail("Empty frame name not allowed");
39: } catch (IllegalArgumentException e) {
40: // Success
41: }
42: }
43:
44: public void testWhitespaceName() {
45: try {
46: new NamedFrame(" ");
47: fail("Whitespace-only frame name not allowed");
48: } catch (IllegalArgumentException e) {
49: // Success
50: }
51: }
52:
53: public void testHTMLName() {
54: try {
55: new NamedFrame("<b>yuck</b>");
56: fail("html in frame name not allowed");
57: } catch (IllegalArgumentException e) {
58: // Success
59: }
60: }
61:
62: public void testQuotesInName() {
63: try {
64: new NamedFrame("he said \"yuck\"");
65: fail("double-quotes in frame name not allowed");
66: } catch (IllegalArgumentException e) {
67: // Success
68: }
69: }
70:
71: public void testApostropheInName() {
72: try {
73: new NamedFrame("he said 'yuck'");
74: fail("apostrophe in frame name not allowed");
75: } catch (IllegalArgumentException e) {
76: // Success
77: }
78: }
79: }
|