1#!/usr/bin/python2.5 2# 3# Copyright 2010 Google Inc. 4# 5# Licensed under the Apache License, Version 2.0 (the 'License') 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an 'AS IS' BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17"""Handlers for New Rich Text Tests""" 18 19__author__ = 'rolandsteiner@google.com (Roland Steiner)' 20 21from google.appengine.api import users 22from google.appengine.ext import db 23from google.appengine.api import memcache 24from google.appengine.ext import webapp 25from google.appengine.ext.webapp import template 26 27import django 28from django import http 29from django import shortcuts 30 31from django.template import add_to_builtins 32add_to_builtins('base.custom_filters') 33 34# Shared stuff 35from categories import all_test_sets 36from base import decorators 37from base import util 38 39# common to the RichText2 suite 40from categories.richtext2 import common 41 42# tests 43from categories.richtext2.tests.apply import APPLY_TESTS 44from categories.richtext2.tests.applyCSS import APPLY_TESTS_CSS 45from categories.richtext2.tests.change import CHANGE_TESTS 46from categories.richtext2.tests.changeCSS import CHANGE_TESTS_CSS 47from categories.richtext2.tests.delete import DELETE_TESTS 48from categories.richtext2.tests.forwarddelete import FORWARDDELETE_TESTS 49from categories.richtext2.tests.insert import INSERT_TESTS 50from categories.richtext2.tests.selection import SELECTION_TESTS 51from categories.richtext2.tests.unapply import UNAPPLY_TESTS 52from categories.richtext2.tests.unapplyCSS import UNAPPLY_TESTS_CSS 53 54from categories.richtext2.tests.querySupported import QUERYSUPPORTED_TESTS 55from categories.richtext2.tests.queryEnabled import QUERYENABLED_TESTS 56from categories.richtext2.tests.queryIndeterm import QUERYINDETERM_TESTS 57from categories.richtext2.tests.queryState import QUERYSTATE_TESTS, QUERYSTATE_TESTS_CSS 58from categories.richtext2.tests.queryValue import QUERYVALUE_TESTS, QUERYVALUE_TESTS_CSS 59 60 61def About(request): 62 """About page.""" 63 overview = """These tests cover browers' implementations of 64 <a href="http://blog.whatwg.org/the-road-to-html-5-contenteditable">contenteditable</a> 65 for basic rich text formatting commands. Most browser implementations do very 66 well at editing the HTML which is generated by their own execCommands. But a 67 big problem happens when developers try to make cross-browser web 68 applications using contenteditable - most browsers are not able to correctly 69 change formatting generated by other browsers. On top of that, most browsers 70 allow users to to paste arbitrary HTML from other webpages into a 71 contenteditable region, which is even harder for browsers to properly 72 format. These tests check how well the execCommand, queryCommandState, 73 and queryCommandValue functions work with different types of HTML.""" 74 return util.About(request, common.CATEGORY, category_title='Rich Text', 75 overview=overview, show_hidden=False) 76 77 78def RunRichText2Tests(request): 79 params = { 80 'classes': common.CLASSES, 81 'commonIDPrefix': common.TEST_ID_PREFIX, 82 'strict': False, 83 'suites': [ 84 SELECTION_TESTS, 85 APPLY_TESTS, 86 APPLY_TESTS_CSS, 87 CHANGE_TESTS, 88 CHANGE_TESTS_CSS, 89 UNAPPLY_TESTS, 90 UNAPPLY_TESTS_CSS, 91 DELETE_TESTS, 92 FORWARDDELETE_TESTS, 93 INSERT_TESTS, 94 95 QUERYSUPPORTED_TESTS, 96 QUERYENABLED_TESTS, 97 QUERYINDETERM_TESTS, 98 QUERYSTATE_TESTS, 99 QUERYSTATE_TESTS_CSS, 100 QUERYVALUE_TESTS, 101 QUERYVALUE_TESTS_CSS 102 ] 103 } 104 return shortcuts.render_to_response('%s/templates/richtext2.html' % common.CATEGORY, params) 105 106 107 108