aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/i18n/uchar/remotenamefetcher_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/i18n/uchar/remotenamefetcher_test.html')
-rw-r--r--contexts/data/lib/closure-library/closure/goog/i18n/uchar/remotenamefetcher_test.html111
1 files changed, 0 insertions, 111 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/i18n/uchar/remotenamefetcher_test.html b/contexts/data/lib/closure-library/closure/goog/i18n/uchar/remotenamefetcher_test.html
deleted file mode 100644
index 3e2dd87..0000000
--- a/contexts/data/lib/closure-library/closure/goog/i18n/uchar/remotenamefetcher_test.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2012 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<html>
- <head>
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>Closure Unit Tests - goog.i18n.uChar.RemoteNameFetcher</title>
- <meta charset="utf-8">
- <script src='../../base.js'>
- </script>
- <script>
- goog.require('goog.i18n.uChar.RemoteNameFetcher');
- goog.require('goog.net.XhrIo');
- goog.require('goog.testing.jsunit');
- goog.require('goog.testing.recordFunction');
- goog.require('goog.testing.net.XhrIo');
- </script>
- </head>
- <body>
- <script>
-var nameFetcher = null;
-
-function setUp() {
- goog.net.XhrIo = goog.testing.net.XhrIo;
- nameFetcher = new goog.i18n.uChar.RemoteNameFetcher('http://www.example.com');
-}
-
-function tearDown() {
- nameFetcher.dispose();
-}
-
-function testGetName_remote() {
- var callback = goog.testing.recordFunction(function(name) {
- assertEquals('Latin Capital Letter P', name);
- assertTrue(nameFetcher.charNames_.containsKey('50'));
- });
- nameFetcher.getName('P', callback);
- var responseJsonText = '{"50":{"name":"Latin Capital Letter P"}}';
- nameFetcher.getNameXhrIo_.simulateResponse(200, responseJsonText);
- assertEquals(1, callback.getCallCount());
-}
-
-function testGetName_existing() {
- nameFetcher.charNames_.set('1049d', 'OSYMANYA LETTER OO');
- var callback = goog.testing.recordFunction(function(name) {
- assertEquals('OSYMANYA LETTER OO', name);
- });
- nameFetcher.getName('\uD801\uDC9D', callback);
- assertEquals(1, callback.getCallCount());
-}
-
-function testGetName_fail() {
- var callback = goog.testing.recordFunction(function(name) {
- assertNull(name);
- });
- nameFetcher.getName('\uD801\uDC9D', callback);
- assertEquals('http://www.example.com?c=1049d&p=name',
- nameFetcher.getNameXhrIo_.getLastUri().toString());
- nameFetcher.getNameXhrIo_.simulateResponse(400);
- assertEquals(1, callback.getCallCount());
-}
-
-function testGetName_abort() {
- var callback1 = goog.testing.recordFunction(function(name) {
- assertNull(name);
- });
- nameFetcher.getName('I', callback1);
- var callback2 = goog.testing.recordFunction(function(name) {
- assertEquals(name, 'LATIN SMALL LETTER Y');
- });
- nameFetcher.getName('ÿ', callback2);
- assertEquals('http://www.example.com?c=ff&p=name',
- nameFetcher.getNameXhrIo_.getLastUri().toString());
- var responseJsonText = '{"ff":{"name":"LATIN SMALL LETTER Y"}}';
- nameFetcher.getNameXhrIo_.simulateResponse(200, responseJsonText);
- assertEquals(1, callback1.getCallCount());
- assertEquals(1, callback2.getCallCount());
-}
-
-function testPrefetch() {
- nameFetcher.prefetch('ÿI\uD801\uDC9D');
- assertEquals('http://www.example.com?b88=%C3%BFI%F0%90%92%9D&p=name',
- nameFetcher.prefetchXhrIo_.getLastUri().toString());
-
- var responseJsonText = '{"ff":{"name":"LATIN SMALL LETTER Y"},"49":{'
- + '"name":"LATIN CAPITAL LETTER I"}, "1049d":{"name":"OSMYANA OO"}}';
- nameFetcher.prefetchXhrIo_.simulateResponse(200, responseJsonText);
-
- assertEquals(3, nameFetcher.charNames_.getCount());
- assertEquals('LATIN SMALL LETTER Y', nameFetcher.charNames_.get('ff'));
- assertEquals('LATIN CAPITAL LETTER I', nameFetcher.charNames_.get('49'));
- assertEquals('OSMYANA OO', nameFetcher.charNames_.get('1049d'));
-}
-
-function testPrefetch_abort() {
- nameFetcher.prefetch('I\uD801\uDC9D');
- nameFetcher.prefetch('ÿ');
- assertEquals('http://www.example.com?b88=%C3%BF&p=name',
- nameFetcher.prefetchXhrIo_.getLastUri().toString());
-}
-
-function testIsNameAvailable() {
- assertTrue(nameFetcher.isNameAvailable('a'));
-}
- </script>
- </body>
-</html>